-static struct ofservice *ofservice_lookup(struct ofproto *,
- const char *target);
-static int ofservice_create(struct ofproto *,
- const struct ofproto_controller *);
-static void ofservice_reconfigure(struct ofservice *,
- const struct ofproto_controller *);
-static void ofservice_destroy(struct ofproto *, struct ofservice *);
-
-/* An OpenFlow connection. */
-struct ofconn {
- struct ofproto *ofproto; /* The ofproto that owns this connection. */
- struct list node; /* In struct ofproto's "all_conns" list. */
- struct rconn *rconn; /* OpenFlow connection. */
- enum ofconn_type type; /* Type. */
-
- /* OFPT_PACKET_IN related data. */
- struct rconn_packet_counter *packet_in_counter; /* # queued on 'rconn'. */
- struct pinsched *schedulers[2]; /* Indexed by reason code; see below. */
- struct pktbuf *pktbuf; /* OpenFlow packet buffers. */
- int miss_send_len; /* Bytes to send of buffered packets. */
-
- /* Number of OpenFlow messages queued on 'rconn' as replies to OpenFlow
- * requests, and the maximum number before we stop reading OpenFlow
- * requests. */
-#define OFCONN_REPLY_MAX 100
- struct rconn_packet_counter *reply_counter;
-
- /* type == OFCONN_PRIMARY only. */
- enum nx_role role; /* Role. */
- struct hmap_node hmap_node; /* In struct ofproto's "controllers" map. */
- struct discovery *discovery; /* Controller discovery object, if enabled. */
- struct status_category *ss; /* Switch status category. */
- enum ofproto_band band; /* In-band or out-of-band? */
-};
-
-/* We use OFPR_NO_MATCH and OFPR_ACTION as indexes into struct ofconn's
- * "schedulers" array. Their values are 0 and 1, and their meanings and values
- * coincide with _ODPL_MISS_NR and _ODPL_ACTION_NR, so this is convenient. In
- * case anything ever changes, check their values here. */
-#define N_SCHEDULERS 2
-BUILD_ASSERT_DECL(OFPR_NO_MATCH == 0);
-BUILD_ASSERT_DECL(OFPR_NO_MATCH == _ODPL_MISS_NR);
-BUILD_ASSERT_DECL(OFPR_ACTION == 1);
-BUILD_ASSERT_DECL(OFPR_ACTION == _ODPL_ACTION_NR);
-
-static struct ofconn *ofconn_create(struct ofproto *, struct rconn *,
- enum ofconn_type);
-static void ofconn_destroy(struct ofconn *);
-static void ofconn_run(struct ofconn *, struct ofproto *);
-static void ofconn_wait(struct ofconn *);
-static bool ofconn_receives_async_msgs(const struct ofconn *);
-static char *ofconn_make_name(const struct ofproto *, const char *target);
-static void ofconn_set_rate_limit(struct ofconn *, int rate, int burst);
-
-static void queue_tx(struct ofpbuf *msg, const struct ofconn *ofconn,
- struct rconn_packet_counter *counter);
-
-static void send_packet_in(struct ofproto *, struct ofpbuf *odp_msg);
-static void do_send_packet_in(struct ofpbuf *odp_msg, void *ofconn);
-
-struct ofproto {
- /* Settings. */
- uint64_t datapath_id; /* Datapath ID. */
- uint64_t fallback_dpid; /* Datapath ID if no better choice found. */
- char *mfr_desc; /* Manufacturer. */
- char *hw_desc; /* Hardware. */
- char *sw_desc; /* Software version. */
- char *serial_desc; /* Serial number. */
- char *dp_desc; /* Datapath description. */
-
- /* Datapath. */
- struct dpif *dpif;
- struct netdev_monitor *netdev_monitor;
- struct hmap ports; /* Contains "struct ofport"s. */
- struct shash port_by_name;
- uint32_t max_ports;
-
- /* Configuration. */
- struct switch_status *switch_status;
- struct fail_open *fail_open;
- struct netflow *netflow;
- struct ofproto_sflow *sflow;
-
- /* In-band control. */
- struct in_band *in_band;
- long long int next_in_band_update;
- struct sockaddr_in *extra_in_band_remotes;
- size_t n_extra_remotes;
-
- /* Flow table. */
- struct classifier cls;
- bool need_revalidate;
- long long int next_expiration;
- struct tag_set revalidate_set;
- bool tun_id_from_cookie;
-
- /* OpenFlow connections. */
- struct hmap controllers; /* Controller "struct ofconn"s. */
- struct list all_conns; /* Contains "struct ofconn"s. */
- enum ofproto_fail_mode fail_mode;
-
- /* OpenFlow listeners. */
- struct hmap services; /* Contains "struct ofservice"s. */
- struct pvconn **snoops;
- size_t n_snoops;
-
- /* Hooks for ovs-vswitchd. */
- const struct ofhooks *ofhooks;
- void *aux;
-
- /* Used by default ofhooks. */
- struct mac_learning *ml;
-};