~james-page/ubuntu/saucy/openvswitch/1.12-snapshot

« back to all changes in this revision

Viewing changes to lib/netdev.h

  • Committer: James Page
  • Date: 2013-08-21 10:16:57 UTC
  • mfrom: (1.1.20)
  • Revision ID: james.page@canonical.com-20130821101657-3o0z0qeiv5zkwlzi
New upstream snapshot

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
extern "C" {
27
27
#endif
28
28
 
29
 
/* Generic interface to network devices.
 
29
/* Generic interface to network devices ("netdev"s).
30
30
 *
31
 
 * Currently, there is a single implementation of this interface that supports
32
 
 * Linux.  The interface should be generic enough to be implementable on other
33
 
 * operating systems as well. */
 
31
 * Every port on a switch must have a corresponding netdev that must minimally
 
32
 * support a few operations, such as the ability to read the netdev's MTU.
 
33
 * The PORTING file at the top of the source tree has more information in the
 
34
 * "Writing a netdev Provider" section. */
34
35
 
 
36
struct netdev;
 
37
struct netdev_class;
 
38
struct netdev_rx;
 
39
struct netdev_saved_flags;
35
40
struct ofpbuf;
36
41
struct in_addr;
37
42
struct in6_addr;
38
43
struct smap;
39
44
struct sset;
40
45
 
41
 
enum netdev_flags {
42
 
    NETDEV_UP = 0x0001,         /* Device enabled? */
43
 
    NETDEV_PROMISC = 0x0002,    /* Promiscuous mode? */
44
 
    NETDEV_LOOPBACK = 0x0004    /* This is a loopback device. */
45
 
};
46
 
 
47
46
/* Network device statistics.
48
47
 *
49
48
 * Values of unsupported statistics are set to all-1-bits (UINT64_MAX). */
87
86
 
88
87
    ovs_be16 dst_port;
89
88
 
 
89
    bool ip_src_flow;
 
90
    bool ip_dst_flow;
90
91
    ovs_be32 ip_src;
91
92
    ovs_be32 ip_dst;
92
93
 
101
102
    bool dont_fragment;
102
103
};
103
104
 
104
 
struct netdev;
105
 
struct netdev_class;
106
 
 
107
105
void netdev_run(void);
108
106
void netdev_wait(void);
109
107
 
110
108
void netdev_enumerate_types(struct sset *types);
 
109
bool netdev_is_reserved_name(const char *name);
111
110
 
112
111
/* Open and close. */
113
112
int netdev_open(const char *name, const char *type, struct netdev **);
 
113
struct netdev *netdev_ref(const struct netdev *);
114
114
void netdev_close(struct netdev *);
115
115
 
116
 
bool netdev_exists(const char *name);
117
 
bool netdev_is_open(const char *name);
118
 
 
119
116
void netdev_parse_name(const char *netdev_name, char **name, char **type);
120
117
 
121
118
/* Options. */
132
129
int netdev_set_mtu(const struct netdev *, int mtu);
133
130
int netdev_get_ifindex(const struct netdev *);
134
131
 
135
 
/* Packet send and receive. */
136
 
int netdev_listen(struct netdev *);
137
 
int netdev_recv(struct netdev *, struct ofpbuf *);
138
 
void netdev_recv_wait(struct netdev *);
139
 
int netdev_drain(struct netdev *);
140
 
 
 
132
/* Packet reception. */
 
133
int netdev_rx_open(struct netdev *, struct netdev_rx **);
 
134
void netdev_rx_close(struct netdev_rx *);
 
135
 
 
136
const char *netdev_rx_get_name(const struct netdev_rx *);
 
137
 
 
138
int netdev_rx_recv(struct netdev_rx *, struct ofpbuf *);
 
139
void netdev_rx_wait(struct netdev_rx *);
 
140
int netdev_rx_drain(struct netdev_rx *);
 
141
 
 
142
/* Packet transmission. */
141
143
int netdev_send(struct netdev *, const struct ofpbuf *);
142
144
void netdev_send_wait(struct netdev *);
143
145
 
180
182
bool netdev_features_is_full_duplex(enum netdev_features features);
181
183
int netdev_set_advertisements(struct netdev *, enum netdev_features advertise);
182
184
 
 
185
/* Flags. */
 
186
enum netdev_flags {
 
187
    NETDEV_UP = 0x0001,         /* Device enabled? */
 
188
    NETDEV_PROMISC = 0x0002,    /* Promiscuous mode? */
 
189
    NETDEV_LOOPBACK = 0x0004    /* This is a loopback device. */
 
190
};
 
191
 
 
192
int netdev_get_flags(const struct netdev *, enum netdev_flags *);
 
193
int netdev_set_flags(struct netdev *, enum netdev_flags,
 
194
                     struct netdev_saved_flags **);
 
195
int netdev_turn_flags_on(struct netdev *, enum netdev_flags,
 
196
                         struct netdev_saved_flags **);
 
197
int netdev_turn_flags_off(struct netdev *, enum netdev_flags,
 
198
                          struct netdev_saved_flags **);
 
199
 
 
200
void netdev_restore_flags(struct netdev_saved_flags *);
 
201
 
183
202
/* TCP/IP stack interface. */
184
203
int netdev_get_in4(const struct netdev *, struct in_addr *address,
185
204
                   struct in_addr *netmask);
192
211
int netdev_get_status(const struct netdev *, struct smap *);
193
212
int netdev_arp_lookup(const struct netdev *, ovs_be32 ip, uint8_t mac[6]);
194
213
 
195
 
int netdev_get_flags(const struct netdev *, enum netdev_flags *);
196
 
int netdev_set_flags(struct netdev *, enum netdev_flags, bool permanent);
197
 
int netdev_turn_flags_on(struct netdev *, enum netdev_flags, bool permanent);
198
 
int netdev_turn_flags_off(struct netdev *, enum netdev_flags, bool permanent);
199
214
struct netdev *netdev_find_dev_by_in4(const struct in_addr *);
200
215
 
201
216
/* Statistics. */