diff options
author | Ben Pfaff <blp@ovn.org> | 2017-07-14 14:33:45 -0700 |
---|---|---|
committer | Ben Pfaff <blp@ovn.org> | 2017-07-17 10:05:54 -0700 |
commit | fd245f1da9c4f87ebb737951a41429cdbe1d8cda (patch) | |
tree | 097482bedb3c2728b6aa73b740d51456f7ae38c2 /lib/socket-util.h | |
parent | b7636967a8901935a1597e973f658c4856663e55 (diff) | |
download | openvswitch-fd245f1da9c4f87ebb737951a41429cdbe1d8cda.tar.gz |
socket-util: Change ss_format_address() to take a dynamic string.
It's occasionally convenient to format into a fixed-size buffer, but
as the use cases, and the text to be formatted, get more sophisticated,
it becomes easier to deal with "struct ds *" than a buffer pointer and
length pair. An upcoming commit will make ss_format_address() do more
work, and I think that this is the point at which it becomes easier to
take a dynamic string. This commit makes the parameter type change
without yet changing what is formatted.
Signed-off-by: Ben Pfaff <blp@ovn.org>
Tested-by: Numan Siddique <nusiddiq@redhat.com>
Acked-by: Numan Siddique <nusiddiq@redhat.com>
Diffstat (limited to 'lib/socket-util.h')
-rw-r--r-- | lib/socket-util.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/socket-util.h b/lib/socket-util.h index ef316cb8c..1782745fa 100644 --- a/lib/socket-util.h +++ b/lib/socket-util.h @@ -28,6 +28,8 @@ #include <netinet/in_systm.h> #include <netinet/ip.h> +struct ds; + int set_nonblocking(int fd); void xset_nonblocking(int fd); void setsockopt_tcp_nodelay(int fd); @@ -71,9 +73,7 @@ char *describe_fd(int fd); /* Functions for working with sockaddr_storage that might contain an IPv4 or * IPv6 address. */ uint16_t ss_get_port(const struct sockaddr_storage *); -#define SS_NTOP_BUFSIZE (1 + INET6_ADDRSTRLEN + 1) -char *ss_format_address(const struct sockaddr_storage *, - char *buf, size_t bufsize); +void ss_format_address(const struct sockaddr_storage *, struct ds *); size_t ss_length(const struct sockaddr_storage *); const char *sock_strerror(int error); |