]> git.proxmox.com Git - ovs.git/blame - secchan/ofproto.h
Fix DHCP request source port and add port #define's
[ovs.git] / secchan / ofproto.h
CommitLineData
064af421
BP
1/*
2 * Copyright (c) 2009 Nicira Networks.
3 *
a14bc59f
BP
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:
064af421 7 *
a14bc59f
BP
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
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.
064af421
BP
15 */
16
17#ifndef OFPROTO_H
18#define OFPROTO_H 1
19
20#include <stdbool.h>
21#include <stddef.h>
22#include <stdint.h>
23#include "flow.h"
24#include "tag.h"
25
26struct odp_actions;
27struct ofhooks;
28struct ofproto;
29struct svec;
30
31struct ofexpired {
32 flow_t flow;
33 uint64_t packet_count; /* Packets from *expired* subrules. */
34 uint64_t byte_count; /* Bytes from *expired* subrules. */
35 long long int used; /* Last-used time (0 if never used). */
36 long long int created; /* Creation time. */
37 uint8_t tcp_flags; /* Bitwise-OR of all TCP flags seen. */
38 uint8_t ip_tos; /* Last-seen IP type-of-service. */
39};
40
41int ofproto_create(const char *datapath, const struct ofhooks *, void *aux,
42 struct ofproto **ofprotop);
43void ofproto_destroy(struct ofproto *);
44int ofproto_run(struct ofproto *);
45int ofproto_run1(struct ofproto *);
46int ofproto_run2(struct ofproto *, bool revalidate_all);
47void ofproto_wait(struct ofproto *);
48bool ofproto_is_alive(const struct ofproto *);
49
50/* Configuration. */
51void ofproto_set_datapath_id(struct ofproto *, uint64_t datapath_id);
52void ofproto_set_mgmt_id(struct ofproto *, uint64_t mgmt_id);
53void ofproto_set_probe_interval(struct ofproto *, int probe_interval);
54void ofproto_set_max_backoff(struct ofproto *, int max_backoff);
55void ofproto_set_desc(struct ofproto *,
56 const char *manufacturer, const char *hardware,
57 const char *software, const char *serial);
58int ofproto_set_in_band(struct ofproto *, bool in_band);
59int ofproto_set_discovery(struct ofproto *, bool discovery,
60 const char *accept_controller_re,
61 bool update_resolv_conf);
62int ofproto_set_controller(struct ofproto *, const char *controller);
63int ofproto_set_listeners(struct ofproto *, const struct svec *listeners);
64int ofproto_set_snoops(struct ofproto *, const struct svec *snoops);
65int ofproto_set_netflow(struct ofproto *, const struct svec *collectors,
66 uint8_t engine_type, uint8_t engine_id, bool add_id_to_iface);
67void ofproto_set_failure(struct ofproto *, bool fail_open);
68void ofproto_set_rate_limit(struct ofproto *, int rate_limit, int burst_limit);
69int ofproto_set_stp(struct ofproto *, bool enable_stp);
70int ofproto_set_remote_execution(struct ofproto *, const char *command_acl,
71 const char *command_dir);
72
73/* Configuration querying. */
74uint64_t ofproto_get_datapath_id(const struct ofproto *);
3b250e29 75uint64_t ofproto_get_mgmt_id(const struct ofproto *);
064af421
BP
76int ofproto_get_probe_interval(const struct ofproto *);
77int ofproto_get_max_backoff(const struct ofproto *);
78bool ofproto_get_in_band(const struct ofproto *);
79bool ofproto_get_discovery(const struct ofproto *);
80const char *ofproto_get_controller(const struct ofproto *);
81void ofproto_get_listeners(const struct ofproto *, struct svec *);
82void ofproto_get_snoops(const struct ofproto *, struct svec *);
83
84/* Functions for use by ofproto implementation modules, not by clients. */
85int ofproto_send_packet(struct ofproto *, const flow_t *,
86 const union ofp_action *, size_t n_actions,
87 const struct ofpbuf *);
88void ofproto_add_flow(struct ofproto *, const flow_t *, uint32_t wildcards,
89 unsigned int priority,
90 const union ofp_action *, size_t n_actions,
91 int idle_timeout);
92void ofproto_delete_flow(struct ofproto *, const flow_t *, uint32_t wildcards,
93 unsigned int priority);
94void ofproto_flush_flows(struct ofproto *);
95
96/* Hooks for ovs-vswitchd. */
97struct ofhooks {
98 void (*port_changed_cb)(enum ofp_port_reason, const struct ofp_phy_port *,
99 void *aux);
100 bool (*normal_cb)(const flow_t *, const struct ofpbuf *packet,
101 struct odp_actions *, tag_type *, 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,
104 void *aux);
105 void (*account_checkpoint_cb)(void *aux);
106};
107void ofproto_revalidate(struct ofproto *, tag_type);
108struct tag_set *ofproto_get_revalidate_set(struct ofproto *);
109
110#endif /* ofproto.h */