2 * Copyright (c) 2009 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.
34 uint64_t packet_count; /* Packets from subrules. */
35 uint64_t byte_count; /* Bytes from subrules. */
36 long long int used; /* Last-used time (0 if never used). */
39 int ofproto_create(const char *datapath, const struct ofhooks *, void *aux,
40 struct ofproto **ofprotop);
41 void ofproto_destroy(struct ofproto *);
42 int ofproto_run(struct ofproto *);
43 int ofproto_run1(struct ofproto *);
44 int ofproto_run2(struct ofproto *, bool revalidate_all);
45 void ofproto_wait(struct ofproto *);
46 bool ofproto_is_alive(const struct ofproto *);
49 void ofproto_set_datapath_id(struct ofproto *, uint64_t datapath_id);
50 void ofproto_set_mgmt_id(struct ofproto *, uint64_t mgmt_id);
51 void ofproto_set_probe_interval(struct ofproto *, int probe_interval);
52 void ofproto_set_max_backoff(struct ofproto *, int max_backoff);
53 void ofproto_set_desc(struct ofproto *,
54 const char *manufacturer, const char *hardware,
55 const char *software, const char *serial);
56 int ofproto_set_in_band(struct ofproto *, bool in_band);
57 int ofproto_set_discovery(struct ofproto *, bool discovery,
58 const char *accept_controller_re,
59 bool update_resolv_conf);
60 int ofproto_set_controller(struct ofproto *, const char *controller);
61 int ofproto_set_listeners(struct ofproto *, const struct svec *listeners);
62 int ofproto_set_snoops(struct ofproto *, const struct svec *snoops);
63 int ofproto_set_netflow(struct ofproto *,
64 const struct netflow_options *nf_options);
65 void ofproto_set_failure(struct ofproto *, bool fail_open);
66 void ofproto_set_rate_limit(struct ofproto *, int rate_limit, int burst_limit);
67 int ofproto_set_stp(struct ofproto *, bool enable_stp);
68 int ofproto_set_remote_execution(struct ofproto *, const char *command_acl,
69 const char *command_dir);
71 /* Configuration querying. */
72 uint64_t ofproto_get_datapath_id(const struct ofproto *);
73 uint64_t ofproto_get_mgmt_id(const struct ofproto *);
74 int ofproto_get_probe_interval(const struct ofproto *);
75 int ofproto_get_max_backoff(const struct ofproto *);
76 bool ofproto_get_in_band(const struct ofproto *);
77 bool ofproto_get_discovery(const struct ofproto *);
78 const char *ofproto_get_controller(const struct ofproto *);
79 void ofproto_get_listeners(const struct ofproto *, struct svec *);
80 void ofproto_get_snoops(const struct ofproto *, struct svec *);
81 void ofproto_get_all_flows(struct ofproto *p, struct ds *);
83 /* Functions for use by ofproto implementation modules, not by clients. */
84 int ofproto_send_packet(struct ofproto *, const flow_t *,
85 const union ofp_action *, size_t n_actions,
86 const struct ofpbuf *);
87 void ofproto_add_flow(struct ofproto *, const flow_t *, uint32_t wildcards,
88 unsigned int priority,
89 const union ofp_action *, size_t n_actions,
91 void ofproto_delete_flow(struct ofproto *, const flow_t *, uint32_t wildcards,
92 unsigned int priority);
93 void ofproto_flush_flows(struct ofproto *);
95 /* Hooks for ovs-vswitchd. */
97 void (*port_changed_cb)(enum ofp_port_reason, const struct ofp_phy_port *,
99 bool (*normal_cb)(const flow_t *, const struct ofpbuf *packet,
100 struct odp_actions *, tag_type *,
101 uint16_t *nf_output_iface, void *aux);
102 void (*account_flow_cb)(const flow_t *, const union odp_action *,
103 size_t n_actions, unsigned long long int n_bytes,
105 void (*account_checkpoint_cb)(void *aux);
107 void ofproto_revalidate(struct ofproto *, tag_type);
108 struct tag_set *ofproto_get_revalidate_set(struct ofproto *);
110 #endif /* ofproto.h */