Switch default OpenFlow port from 975 and 976 to 6633.
[sliver-openvswitch.git] / include / nicira-ext.h
1 /*
2  * Distributed under the terms of the GNU GPL version 2.
3  * Copyright (c) 2008 Nicira Networks
4  */
5
6 #ifndef NICIRA_EXT_H
7 #define NICIRA_EXT_H 1
8
9 #include "openflow.h"
10
11 /* The following vendor extensions, proposed by Nicira Networks, are not yet
12  * ready for standardization (and may never be), so they are not included in
13  * openflow.h. */
14
15 #define NX_VENDOR_ID 0x00002320
16
17 enum nicira_type {
18     /* Switch status request.  The request body is an ASCII string that
19      * specifies a prefix of the key names to include in the output; if it is
20      * the null string, then all key-value pairs are included. */
21     NXT_STATUS_REQUEST,
22
23     /* Switch status reply.  The reply body is an ASCII string of key-value
24      * pairs in the form "key=value\n". */
25     NXT_STATUS_REPLY,
26
27     /* Configure an action.  Most actions do not require configuration
28      * beyond that supplied in the actual action call. */
29     NXT_ACT_SET_CONFIG,
30
31     /* Get configuration of action. */
32     NXT_ACT_GET_CONFIG
33 };
34
35 struct nicira_header {
36     struct ofp_header header;
37     uint32_t vendor;            /* NX_VENDOR_ID. */
38     uint32_t subtype;           /* One of NXT_* above. */
39 };
40 OFP_ASSERT(sizeof(struct nicira_header) == sizeof(struct ofp_vendor_header) + 4);
41
42
43 enum nx_snat_command {
44     NXSC_ADD,
45     NXSC_DELETE
46 };
47
48 /* Configuration for source-NATing */
49 struct nx_snat_config {
50     uint8_t command;        /* One of NXSC_*. */
51     uint8_t pad[3];
52     uint16_t port;          /* Physical switch port. */
53     uint16_t mac_timeout;   /* Time to cache MAC addresses of SNAT'd hosts
54                                in seconds.  0 uses the default value. */
55
56     /* Range of IP addresses to impersonate.  Set both values to the
57      * same to support a single address.  */
58     uint32_t ip_addr_start; 
59     uint32_t ip_addr_end;
60
61     /* Range of transport ports that should be used as new source port.  A
62      * value of zero, let's the switch choose.*/
63     uint16_t tcp_start;
64     uint16_t tcp_end;
65     uint16_t udp_start;
66     uint16_t udp_end;
67 };
68 OFP_ASSERT(sizeof(struct nx_snat_config) == 24);
69
70 /* Action configuration.  Not all actions require separate configuration. */
71 struct nx_act_config {
72     struct nicira_header header;
73     uint16_t type;          /* One of OFPAT_* */
74     uint8_t pad[2];
75     union {
76         struct nx_snat_config snat[0];
77     };                      /* Array of action configurations.  The number 
78                                is inferred from the length field in the 
79                                header. */
80 };
81 OFP_ASSERT(sizeof(struct nx_act_config) == 20);
82
83
84 enum nx_action_subtype {
85     NXAST_SNAT                      /* Source-NAT */
86 };
87
88 /* Action structure for NXAST_SNAT. */
89 struct nx_action_snat {
90     uint16_t type;                  /* OFPAT_VENDOR. */
91     uint16_t len;                   /* Length is 8. */
92     uint32_t vendor;                /* NX_VENDOR_ID. */
93     uint16_t subtype;               /* NXAST_SNAT. */
94     uint16_t port;                  /* Output port--it must be previously 
95                                        configured. */
96     uint8_t pad[4];
97 };
98 OFP_ASSERT(sizeof(struct nx_action_snat) == 16);
99
100 /* Header for Nicira-defined actions. */
101 struct nx_action_header {
102     uint16_t type;                  /* OFPAT_VENDOR. */
103     uint16_t len;                   /* Length is 8. */
104     uint32_t vendor;                /* NX_VENDOR_ID. */
105     uint16_t subtype;               /* NXAST_*. */
106     uint8_t pad[6];
107 };
108 OFP_ASSERT(sizeof(struct nx_action_header) == 16);
109
110 #endif /* nicira-ext.h */