~ubuntu-branches/ubuntu/wily/openvswitch/wily

« back to all changes in this revision

Viewing changes to lib/socket-util.h

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2015-08-10 11:35:15 UTC
  • mfrom: (1.1.30)
  • Revision ID: package-import@ubuntu.com-20150810113515-575vj06oq29emxsn
Tags: 2.4.0~git20150810.97bab95-0ubuntu1
* New upstream snapshot from 2.4 branch:
  - d/*: Align any relevant packaging changes with upstream.
* d/*: wrap-and-sort.
* d/openvswitch-{common,vswitch}.install: Correct install location for
  bash completion files.
* d/tests/openflow.py: Explicitly use ovs-testcontroller as provided
  by 2.4.0 release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
 
30
30
int set_nonblocking(int fd);
31
31
void xset_nonblocking(int fd);
 
32
void setsockopt_tcp_nodelay(int fd);
32
33
int set_dscp(int fd, int family, uint8_t dscp);
33
34
 
34
35
int lookup_ip(const char *host_name, struct in_addr *address);
38
39
 
39
40
int get_socket_rcvbuf(int sock);
40
41
int check_connection_completion(int fd);
41
 
#ifndef _WIN32
42
 
int drain_rcvbuf(int fd);
43
 
#endif
44
42
void drain_fd(int fd, size_t n_packets);
45
 
#ifndef _WIN32
46
 
int make_unix_socket(int style, bool nonblock,
47
 
                     const char *bind_path, const char *connect_path);
48
 
int get_unix_name_len(socklen_t sun_len);
49
 
#endif
50
43
ovs_be32 guess_netmask(ovs_be32 ip);
51
44
 
52
45
bool inet_parse_active(const char *target, uint16_t default_port,
57
50
bool inet_parse_passive(const char *target, int default_port,
58
51
                        struct sockaddr_storage *ssp);
59
52
int inet_open_passive(int style, const char *target, int default_port,
60
 
                      struct sockaddr_storage *ssp, uint8_t dscp);
 
53
                      struct sockaddr_storage *ssp, uint8_t dscp,
 
54
                      bool kernel_print_port);
61
55
 
62
56
int read_fully(int fd, void *, size_t, size_t *bytes_read);
63
57
int write_fully(int fd, const void *, size_t, size_t *bytes_written);
65
59
int fsync_parent_dir(const char *file_name);
66
60
int get_mtime(const char *file_name, struct timespec *mtime);
67
61
 
68
 
#ifndef _WIN32
69
 
void xpipe(int fds[2]);
70
 
void xpipe_nonblocking(int fds[2]);
71
 
#endif
72
 
 
73
62
char *describe_fd(int fd);
74
63
 
75
64
/* Default value of dscp bits for connection between controller and manager.
77
66
 * in <netinet/ip.h> is used. */
78
67
#define DSCP_DEFAULT (IPTOS_PREC_INTERNETCONTROL >> 2)
79
68
 
80
 
#ifndef _WIN32
81
 
/* Helpers for calling ioctl() on an AF_INET socket. */
82
 
struct ifreq;
83
 
int af_inet_ioctl(unsigned long int command, const void *arg);
84
 
int af_inet_ifreq_ioctl(const char *name, struct ifreq *,
85
 
                        unsigned long int cmd, const char *cmd_name);
86
 
#endif
87
 
 
88
69
/* Functions for working with sockaddr_storage that might contain an IPv4 or
89
70
 * IPv6 address. */
90
71
uint16_t ss_get_port(const struct sockaddr_storage *);
94
75
size_t ss_length(const struct sockaddr_storage *);
95
76
const char *sock_strerror(int error);
96
77
 
 
78
#ifndef _WIN32
 
79
void xpipe(int fds[2]);
 
80
void xpipe_nonblocking(int fds[2]);
 
81
 
 
82
int drain_rcvbuf(int fd);
 
83
 
 
84
int make_unix_socket(int style, bool nonblock,
 
85
                     const char *bind_path, const char *connect_path);
 
86
int get_unix_name_len(socklen_t sun_len);
 
87
 
 
88
/* Helpers for calling ioctl() on an AF_INET socket. */
 
89
struct ifreq;
 
90
int af_inet_ioctl(unsigned long int command, const void *arg);
 
91
int af_inet_ifreq_ioctl(const char *name, struct ifreq *,
 
92
                        unsigned long int cmd, const char *cmd_name);
 
93
 
 
94
#define closesocket close
 
95
#endif
 
96
 
97
97
#ifdef _WIN32
 
98
static inline int make_unix_socket(int style, bool nonblock,
 
99
                                   const char *bind_path,
 
100
                                   const char *connect_path)
 
101
{
 
102
    return -EINVAL;
 
103
}
 
104
 
98
105
/* Windows defines the 'optval' argument as char * instead of void *. */
99
106
#define setsockopt(sock, level, optname, optval, optlen) \
100
107
    rpl_setsockopt(sock, level, optname, optval, optlen)
124
131
#endif
125
132
}
126
133
 
127
 
#ifndef _WIN32
128
 
#define closesocket close
129
 
#endif
130
 
 
131
134
#endif /* socket-util.h */