mirror of
https://github.com/openvswitch/ovs
synced 2025-09-05 00:35:33 +00:00
socket-util: Refactor unix specific code to a new file.
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
This commit is contained in:
@@ -38,15 +38,7 @@ int lookup_hostname(const char *host_name, struct in_addr *);
|
||||
|
||||
int get_socket_rcvbuf(int sock);
|
||||
int check_connection_completion(int fd);
|
||||
#ifndef _WIN32
|
||||
int drain_rcvbuf(int fd);
|
||||
#endif
|
||||
void drain_fd(int fd, size_t n_packets);
|
||||
#ifndef _WIN32
|
||||
int make_unix_socket(int style, bool nonblock,
|
||||
const char *bind_path, const char *connect_path);
|
||||
int get_unix_name_len(socklen_t sun_len);
|
||||
#endif
|
||||
ovs_be32 guess_netmask(ovs_be32 ip);
|
||||
|
||||
bool inet_parse_active(const char *target, uint16_t default_port,
|
||||
@@ -65,11 +57,6 @@ int write_fully(int fd, const void *, size_t, size_t *bytes_written);
|
||||
int fsync_parent_dir(const char *file_name);
|
||||
int get_mtime(const char *file_name, struct timespec *mtime);
|
||||
|
||||
#ifndef _WIN32
|
||||
void xpipe(int fds[2]);
|
||||
void xpipe_nonblocking(int fds[2]);
|
||||
#endif
|
||||
|
||||
char *describe_fd(int fd);
|
||||
|
||||
/* Default value of dscp bits for connection between controller and manager.
|
||||
@@ -77,14 +64,6 @@ char *describe_fd(int fd);
|
||||
* in <netinet/ip.h> is used. */
|
||||
#define DSCP_DEFAULT (IPTOS_PREC_INTERNETCONTROL >> 2)
|
||||
|
||||
#ifndef _WIN32
|
||||
/* Helpers for calling ioctl() on an AF_INET socket. */
|
||||
struct ifreq;
|
||||
int af_inet_ioctl(unsigned long int command, const void *arg);
|
||||
int af_inet_ifreq_ioctl(const char *name, struct ifreq *,
|
||||
unsigned long int cmd, const char *cmd_name);
|
||||
#endif
|
||||
|
||||
/* Functions for working with sockaddr_storage that might contain an IPv4 or
|
||||
* IPv6 address. */
|
||||
uint16_t ss_get_port(const struct sockaddr_storage *);
|
||||
@@ -94,6 +73,25 @@ char *ss_format_address(const struct sockaddr_storage *,
|
||||
size_t ss_length(const struct sockaddr_storage *);
|
||||
const char *sock_strerror(int error);
|
||||
|
||||
#ifndef _WIN32
|
||||
void xpipe(int fds[2]);
|
||||
void xpipe_nonblocking(int fds[2]);
|
||||
|
||||
int drain_rcvbuf(int fd);
|
||||
|
||||
int make_unix_socket(int style, bool nonblock,
|
||||
const char *bind_path, const char *connect_path);
|
||||
int get_unix_name_len(socklen_t sun_len);
|
||||
|
||||
/* Helpers for calling ioctl() on an AF_INET socket. */
|
||||
struct ifreq;
|
||||
int af_inet_ioctl(unsigned long int command, const void *arg);
|
||||
int af_inet_ifreq_ioctl(const char *name, struct ifreq *,
|
||||
unsigned long int cmd, const char *cmd_name);
|
||||
|
||||
#define closesocket close
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
/* Windows defines the 'optval' argument as char * instead of void *. */
|
||||
#define setsockopt(sock, level, optname, optval, optlen) \
|
||||
@@ -124,8 +122,4 @@ static inline int sock_errno(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef _WIN32
|
||||
#define closesocket close
|
||||
#endif
|
||||
|
||||
#endif /* socket-util.h */
|
||||
|
Reference in New Issue
Block a user