1 Star 0 Fork 0

Mirror711/libu

Create your Gitee Account
Explore and code with more than 12 million developers,Free private repositories !:)
Sign up
Clone or Download
INTERFACE_CHANGES 5.08 KB
Copy Edit Raw Blame History
tho authored 2010-01-15 17:47 . [libu] --compat_1x and related stuff
TODO: document --compat_1x effects
[uri]:
This module has been completely rewritten for RFC 3986 conformance.
u_uri_parse has been removed: the new parsing interface, which also takes
a bitmask of parsing options as its second parameter, is:
* int u_uri_crumble (const char *s, u_uri_opts_t opts, u_uri_t **pu)
instead of the old:
* int u_uri_parse (const char *s, u_uri_t **pu)
Also, u_uri_t is now opaque type and its attributes can be accessed only
through their getter methods:
* const char *u_uri_get_scheme (u_uri_t *u)
* const char *u_uri_get_user (u_uri_t *u)
* const char *u_uri_get_pwd (u_uri_t *u)
* const char *u_uri_get_host (u_uri_t *u)
* const char *u_uri_get_port (u_uri_t *u)
* const char *u_uri_get_authority (u_uri_t *u)
* const char *u_uri_get_path (u_uri_t *u)
* const char *u_uri_get_query (u_uri_t *u)
* const char *u_uri_get_fragment (u_uri_t *u)
* const char *u_uri_get_userinfo (u_uri_t *u);
A new interface for building conformant URI string as been added:
* int u_uri_knead (u_uri_t *u, char s[U_URI_STRMAX])
together with the needed setter methods:
* int u_uri_set_scheme (u_uri_t *u, const char *val)
* int u_uri_set_user (u_uri_t *u, const char *val)
* int u_uri_set_pwd (u_uri_t *u, const char *val)
* int u_uri_set_host (u_uri_t *u, const char *val)
* int u_uri_set_port (u_uri_t *u, const char *val)
* int u_uri_set_authority (u_uri_t *u, const char *val)
* int u_uri_set_path (u_uri_t *u, const char *val)
* int u_uri_set_query (u_uri_t *u, const char *val)
* int u_uri_set_fragment (u_uri_t *u, const char *val)
* int u_uri_set_userinfo (u_uri_t *u, const char *val);
The u_uri_parse function accepts as last optional argument a bitmask of
U_URI_OPTS_* to tweak some parsing choices.
[buf]:
u_buf_t is now opaque. Type attributes can be accessed only through their
getter methods, which where already present in 1.x:
* void *u_buf_ptr (u_buf_t *buf);
* size_t u_buf_len (u_buf_t *buf);
* size_t u_buf_size (u_buf_t *buf);
[net]:
This module has been completely revamped, both implementation and
interfaces have changed dramatically, the rationale being "more simplicity":
the creation of sockets using UNIX IPC, TCP, UDP and SCTP over IPv4 and
IPv6 is carried out through the very same interface.
The sole chance for your application to be backwards compatible is in case
it used the u_net_sock() only (which is indeed likely to happen).
Interfaces removed:
* u_net_sock_tcp
* u_net_sock_udp
* u_net_sock_unix
* u_net_tcp4_ssock
* u_net_tcp4_csock
* u_net_tcp6_ssock
* u_net_tcp6_csock
* u_net_unix_ssock
* u_net_unix_csock
* u_net_uri2sin
* u_net_uri2sun
* u_net_addr_new
Interfaces changed:
* u_net_uri2addr
the socket 'mode' has been added as a mandatory input parameter
* u_net_sock (XXX u_net_sd, see compat.h)
the socket 'mode' has been added as an optional input parameter in
a backwards-compatible way
Newly added interfaces:
* u_net_sock_by_addr
* u_net_addr_set_opts
* u_net_addr_add_opts
* u_net_addr_can_accept
* u_socket
* u_connect
* u_listen
* u_bind
* u_setsockopt
* u_getsockopt
* u_sa_ntop
* u_inet_ntop
[array]
The setter/getter methods for generic pointers have been restyled. See
http://coding.derkeiler.com/Archive/C_CPP/comp.lang.c/2008-10/msg01683.html
for details about the reason why we had to move. The following interfaces
have been modified: they give back the error code through a result argument,
and the generic (ie. void*) pointer as the returned value:
New interfaces:
* void *u_array_get_ptr (u_array_t *da, size_t idx, int *prc);
* void *u_array_set_ptr (u_array_t *da, size_t idx, void *v, int *prc);
Old (removed) interfaces:
* int u_array_get_ptr (u_array_t *da, size_t idx, void **pv);
* int u_array_set_ptr (u_array_t *da, size_t idx, void *v, void **pold);
Note that the returned pointer is not sufficient to point out a failure in
the get/set operation, since a NULL value could be perfectly valid:
*always* use '*prc' to discriminate between a good (i.e. *prc == 0) and bad
(i.e. *prc == -1) run.
[misc]
The following interfaces have been deprecated:
* u_tokenize in favour of u_strtok
* u_strncpy in favour of u_strlcpy
[carpal]
The following macros have been renamed to avoid name clash with <err.h>
functions:
* dbg() becomes u_dbg()
* info() becomes u_info()
* notice() becomes u_notice()
* warn() becomes u_warn()
* err() becomes u_err()
* crit() becomes u_crit()
* alert() becomes u_alert()
* emerg() becomes u_emerg()
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/Mirror711/libu.git
git@gitee.com:Mirror711/libu.git
Mirror711
libu
libu
master

Search

23e8dbc6 1850385 7e0993f3 1850385