2 * Copyright (c) 2008, 2009, 2010 Nicira Networks.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at:
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
24 #include "openflow/openflow.h"
25 #include "openvswitch/xflow.h"
40 int xf_register_provider(const struct xfif_class *);
41 int xf_unregister_provider(const char *type);
42 void xf_enumerate_types(struct svec *types);
44 int xf_enumerate_names(const char *type, struct svec *names);
45 void xf_parse_name(const char *datapath_name, char **name, char **type);
47 int xfif_open(const char *name, const char *type, struct xfif **);
48 int xfif_create(const char *name, const char *type, struct xfif **);
49 int xfif_create_and_open(const char *name, const char *type, struct xfif **);
50 void xfif_close(struct xfif *);
52 const char *xfif_name(const struct xfif *);
53 const char *xfif_base_name(const struct xfif *);
54 int xfif_get_all_names(const struct xfif *, struct svec *);
56 int xfif_delete(struct xfif *);
58 int xfif_get_xf_stats(const struct xfif *, struct xflow_stats *);
59 int xfif_get_drop_frags(const struct xfif *, bool *drop_frags);
60 int xfif_set_drop_frags(struct xfif *, bool drop_frags);
62 int xfif_port_add(struct xfif *, const char *devname, uint16_t flags,
64 int xfif_port_del(struct xfif *, uint16_t port_no);
65 int xfif_port_query_by_number(const struct xfif *, uint16_t port_no,
67 int xfif_port_query_by_name(const struct xfif *, const char *devname,
69 int xfif_port_get_name(struct xfif *, uint16_t port_no,
70 char *name, size_t name_size);
71 int xfif_port_list(const struct xfif *, struct xflow_port **, size_t *n_ports);
73 int xfif_port_poll(const struct xfif *, char **devnamep);
74 void xfif_port_poll_wait(const struct xfif *);
76 int xfif_port_group_get(const struct xfif *, uint16_t group,
77 uint16_t **ports, size_t *n_ports);
78 int xfif_port_group_set(struct xfif *, uint16_t group,
79 const uint16_t ports[], size_t n_ports);
81 int xfif_flow_flush(struct xfif *);
82 int xfif_flow_put(struct xfif *, struct xflow_flow_put *);
83 int xfif_flow_del(struct xfif *, struct xflow_flow *);
84 int xfif_flow_get(const struct xfif *, struct xflow_flow *);
85 int xfif_flow_get_multiple(const struct xfif *, struct xflow_flow[], size_t n);
86 int xfif_flow_list(const struct xfif *, struct xflow_flow[], size_t n,
88 int xfif_flow_list_all(const struct xfif *,
89 struct xflow_flow **flowsp, size_t *np);
91 int xfif_execute(struct xfif *, uint16_t in_port,
92 const union xflow_action[], size_t n_actions,
93 const struct ofpbuf *);
95 /* Minimum number of bytes of headroom for a packet returned by xfif_recv()
96 * member function. This headroom allows "struct xflow_msg" to be replaced by
97 * "struct ofp_packet_in" without copying the buffer. */
98 #define XFIF_RECV_MSG_PADDING (sizeof(struct ofp_packet_in) \
99 - sizeof(struct xflow_msg))
100 BUILD_ASSERT_DECL(sizeof(struct ofp_packet_in) > sizeof(struct xflow_msg));
101 BUILD_ASSERT_DECL(XFIF_RECV_MSG_PADDING % 4 == 0);
103 int xfif_recv_get_mask(const struct xfif *, int *listen_mask);
104 int xfif_recv_set_mask(struct xfif *, int listen_mask);
105 int xfif_get_sflow_probability(const struct xfif *, uint32_t *probability);
106 int xfif_set_sflow_probability(struct xfif *, uint32_t probability);
107 int xfif_recv(struct xfif *, struct ofpbuf **);
108 int xfif_recv_purge(struct xfif *);
109 void xfif_recv_wait(struct xfif *);
111 void xfif_get_netflow_ids(const struct xfif *,
112 uint8_t *engine_type, uint8_t *engine_id);
114 int xfif_queue_to_priority(const struct xfif *, uint32_t queue_id,