2 * Copyright (c) 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.
38 uint64_t packet_count; /* Packets from subrules. */
39 uint64_t byte_count; /* Bytes from subrules. */
40 long long int used; /* Last-used time (0 if never used). */
43 struct ofproto_sflow_options {
45 uint32_t sampling_rate;
46 uint32_t polling_interval;
53 #define DEFAULT_MFR_DESC "Nicira Networks, Inc."
54 #define DEFAULT_HW_DESC "Open vSwitch"
55 #define DEFAULT_SW_DESC VERSION BUILDNR
56 #define DEFAULT_SERIAL_DESC "None"
57 #define DEFAULT_DP_DESC "None"
59 int ofproto_create(const char *datapath, const char *datapath_type,
60 const struct ofhooks *, void *aux,
61 struct ofproto **ofprotop);
62 void ofproto_destroy(struct ofproto *);
63 int ofproto_run(struct ofproto *);
64 int ofproto_run1(struct ofproto *);
65 int ofproto_run2(struct ofproto *, bool revalidate_all);
66 void ofproto_wait(struct ofproto *);
67 bool ofproto_is_alive(const struct ofproto *);
70 void ofproto_set_datapath_id(struct ofproto *, uint64_t datapath_id);
71 void ofproto_set_probe_interval(struct ofproto *, int probe_interval);
72 void ofproto_set_max_backoff(struct ofproto *, int max_backoff);
73 void ofproto_set_desc(struct ofproto *,
74 const char *mfr_desc, const char *hw_desc,
75 const char *sw_desc, const char *serial_desc,
77 int ofproto_set_in_band(struct ofproto *, bool in_band);
78 int ofproto_set_discovery(struct ofproto *, bool discovery,
79 const char *accept_controller_re,
80 bool update_resolv_conf);
81 int ofproto_set_controller(struct ofproto *, const char *controller);
82 int ofproto_set_listeners(struct ofproto *, const struct svec *listeners);
83 int ofproto_set_snoops(struct ofproto *, const struct svec *snoops);
84 int ofproto_set_netflow(struct ofproto *,
85 const struct netflow_options *nf_options);
86 void ofproto_set_sflow(struct ofproto *, const struct ofproto_sflow_options *);
87 void ofproto_set_failure(struct ofproto *, bool fail_open);
88 void ofproto_set_rate_limit(struct ofproto *, int rate_limit, int burst_limit);
89 int ofproto_set_stp(struct ofproto *, bool enable_stp);
91 /* Configuration querying. */
92 uint64_t ofproto_get_datapath_id(const struct ofproto *);
93 int ofproto_get_probe_interval(const struct ofproto *);
94 int ofproto_get_max_backoff(const struct ofproto *);
95 bool ofproto_get_in_band(const struct ofproto *);
96 bool ofproto_get_discovery(const struct ofproto *);
97 const char *ofproto_get_controller(const struct ofproto *);
98 void ofproto_get_listeners(const struct ofproto *, struct svec *);
99 void ofproto_get_snoops(const struct ofproto *, struct svec *);
100 void ofproto_get_all_flows(struct ofproto *p, struct ds *);
102 /* Functions for use by ofproto implementation modules, not by clients. */
103 int ofproto_send_packet(struct ofproto *, const flow_t *,
104 const union ofp_action *, size_t n_actions,
105 const struct ofpbuf *);
106 void ofproto_add_flow(struct ofproto *, const flow_t *,
107 const union ofp_action *, size_t n_actions,
109 void ofproto_delete_flow(struct ofproto *, const flow_t *);
110 void ofproto_flush_flows(struct ofproto *);
112 /* Hooks for ovs-vswitchd. */
114 void (*port_changed_cb)(enum ofp_port_reason, const struct ofp_phy_port *,
116 bool (*normal_cb)(const flow_t *, const struct ofpbuf *packet,
117 struct xflow_actions *, tag_type *,
118 uint16_t *nf_output_iface, void *aux);
119 void (*account_flow_cb)(const flow_t *, const union xflow_action *,
120 size_t n_actions, unsigned long long int n_bytes,
122 void (*account_checkpoint_cb)(void *aux);
124 void ofproto_revalidate(struct ofproto *, tag_type);
125 struct tag_set *ofproto_get_revalidate_set(struct ofproto *);
131 #endif /* ofproto.h */