From 04905aaeffba2bc77866a4056dc3f2020a86bb26 Mon Sep 17 00:00:00 2001
From: Laurent Bercot
- unsigned int ip46_fmt (char *s, ip46_t const *a)
+ size_t ip46_fmt (char *s, ip46_t const *a)
Formats the address in *a into the string s, which
must be preallocated. Returns the number of bytes written. The address
will be accordingly formatted as IPv4 or IPv6.
- unsigned int ip46_scan (char const *s, ip46_t *a)
+ size_t ip46_scan (char const *s, ip46_t *a)
Scans the string s for an IPv4 or IPv6 address. If it finds
one, writes it into *a and returns the number of bytes read.
If it cannot, returns 0.
- unsigned int ip46_scanlist (ip46_t *list, unsigned int max, char const *s, unsigned int *n)
+ size_t ip46_scanlist (ip46_t *list, size_t max, char const *s, size_t *n)
Scans the string s for a list of comma-, semicolon-, space-, tab- or
newline-separated IPv4 or IPv6 addresses, up to a maximum of max. It
stores them into the (preallocated) ip46_t array pointed to by list.
@@ -97,24 +97,24 @@ IP list at all), and stores the number of found and scanned addresses into *
- int socket_connect46 (int fd, ip46_t *a, uint16 port)
+ int socket_connect46 (int fd, ip46_t *a, uint16_t port)
Connects the socket fd to address *a and port port.
Returns 0 in case of success, and -1 (and sets errno) in case of failure.
- int socket_bind46 (int fd, ip46_t *a, uint16 port)
+ int socket_bind46 (int fd, ip46_t *a, uint16_t port)
Binds the socket fd to address *a and port port.
Returns 0 in case of success, and -1 (and sets errno) in case of failure.
- int socket_bind46_reuse (int fd, ip46_t *a, uint16 port)
+ int socket_bind46_reuse (int fd, ip46_t *a, uint16_t port)
Same as the previous function, with the SO_REUSEADDR option.
- int socket_deadlineconnstamp46 (int fd, ip46_t const *a, uint16 port, tain_t const *deadline, tain_t *stamp)
+ int socket_deadlineconnstamp46 (int fd, ip46_t const *a, uint16_t port, tain_t const *deadline, tain_t *stamp)
Attempts to synchronously connect the socket fd to address aa
and port port. Returns 1 if it succeeds and 0 (and sets errno)
if it fails. stamp must contain an accurate enough
@@ -124,35 +124,35 @@ returns 0 ETIMEDOUT.
- int socket_recv46 (int fd, char *s, unsigned int len, ip46_t *a, uint16 *port)
+ ssize_t socket_recv46 (int fd, char *s, size_t len, ip46_t *a, uint16_t *port)
Reads a datagram from socket fd. The message is stored into buffer s
of max length len, and stores the sender information into address *a
and port *port. Returns the length of the read datagram, or -1 if it fails.
- int socket_send46 (int fd, char const *s, unsigned int len, ip46_t const *a, uint16 port)
+ ssize_t socket_send46 (int fd, char const *s, size_t len, ip46_t const *a, uint16_t port)
Writes a datagram to socket fd. The message is read from buffer s
of length len, and the recipient information is address *a
and port port. Returns the number of written bytes, or -1 if it fails.
- int socket_local46 (int fd, ip46_t *a, uint16 *port)
+ int socket_local46 (int fd, ip46_t *a, uint16_t *port)
Gets the local information about bound socket fd: the local IP
address is stored into *a and the local port into *port.
Returns 0 in case of success, and -1 (and sets errno) in case of failure.
- int socket_remote46 (int fd, ip46_t *a, uint16 *port)
+ int socket_remote46 (int fd, ip46_t *a, uint16_t *port)
Gets the peer information about connected socket fd: the remote IP
address is stored into *a and the remote port into *port.
Returns 0 in case of success, and -1 (and sets errno) in case of failure.
- int socket_recvnb46 (int fd, char *s, unsigned int len, ip46_t *a, uint16 *port,
+ ssize_t socket_recvnb46 (int fd, char *s, size_t len, ip46_t *a, uint16_t *port,
tain_t const *deadline, tain_t *stamp)
Like socket_recv46, except that the function blocks until a datagram
is received. *stamp must be an accurate enough approximation of the
@@ -161,7 +161,7 @@ arrived by absolute date *deadline, the function returns -1 ETIMEOUT.
- int socket_sendnb46 (int fd, char const *s, unsigned int len, ip46_t const *a, uint16 port,
+ ssize_t socket_sendnb46 (int fd, char const *s, size_t len, ip46_t const *a, uint16_t port,
tain_t const *deadline, tain_t *stamp)
Like socket_send46, except that the function blocks until a datagram
has been effectively sent. *stamp must be an accurate enough approximation of the
--
cgit v1.3.1