Import from old repository commit 61ef2b42a9c4ba8e1600f15bb0236765edc2ad45.
[cascardo/ovs.git] / include / openflow / nicira-ext.h
1 /*
2  * Distributed under the terms of the GNU GPL version 2.
3  * Copyright (c) 2008, 2009 Nicira Networks
4  */
5
6 #ifndef OPENFLOW_NICIRA_EXT_H
7 #define OPENFLOW_NICIRA_EXT_H 1
8
9 #include "openflow/openflow.h"
10
11 #define NICIRA_OUI_STR "002320"
12
13 /* The following vendor extensions, proposed by Nicira Networks, are not yet
14  * ready for standardization (and may never be), so they are not included in
15  * openflow.h. */
16
17 #define NX_VENDOR_ID 0x00002320
18
19 enum nicira_type {
20     /* Switch status request.  The request body is an ASCII string that
21      * specifies a prefix of the key names to include in the output; if it is
22      * the null string, then all key-value pairs are included. */
23     NXT_STATUS_REQUEST,
24
25     /* Switch status reply.  The reply body is an ASCII string of key-value
26      * pairs in the form "key=value\n". */
27     NXT_STATUS_REPLY,
28
29     /* Configure an action.  Most actions do not require configuration
30      * beyond that supplied in the actual action call. */
31     NXT_ACT_SET_CONFIG,
32
33     /* Get configuration of action. */
34     NXT_ACT_GET_CONFIG,
35
36     /* Remote command execution.  The request body is a sequence of strings
37      * delimited by null bytes.  The first string is a command name.
38      * Subsequent strings are command arguments. */
39     NXT_COMMAND_REQUEST,
40
41     /* Remote command execution reply, sent when the command's execution
42      * completes.  The reply body is struct nx_command_reply. */
43     NXT_COMMAND_REPLY,
44
45     /* No longer used. */
46     NXT_FLOW_END_CONFIG__OBSOLETE,
47
48     /* No longer used. */
49     NXT_FLOW_END__OBSOLETE,
50
51     /* Management protocol.  See "openflow-mgmt.h". */
52     NXT_MGMT,
53 };
54
55 struct nicira_header {
56     struct ofp_header header;
57     uint32_t vendor;            /* NX_VENDOR_ID. */
58     uint32_t subtype;           /* One of NXT_* above. */
59 };
60 OFP_ASSERT(sizeof(struct nicira_header) == sizeof(struct ofp_vendor_header) + 4);
61
62
63 enum nx_action_subtype {
64     NXAST_SNAT__OBSOLETE,           /* No longer used. */
65     NXAST_RESUBMIT                  /* Throw against flow table again. */
66 };
67
68 /* Action structure for NXAST_RESUBMIT. */
69 struct nx_action_resubmit {
70     uint16_t type;                  /* OFPAT_VENDOR. */
71     uint16_t len;                   /* Length is 8. */
72     uint32_t vendor;                /* NX_VENDOR_ID. */
73     uint16_t subtype;               /* NXAST_RESUBMIT. */
74     uint16_t in_port;               /* New in_port for checking flow table. */
75     uint8_t pad[4];
76 };
77 OFP_ASSERT(sizeof(struct nx_action_resubmit) == 16);
78
79 /* Header for Nicira-defined actions. */
80 struct nx_action_header {
81     uint16_t type;                  /* OFPAT_VENDOR. */
82     uint16_t len;                   /* Length is 8. */
83     uint32_t vendor;                /* NX_VENDOR_ID. */
84     uint16_t subtype;               /* NXAST_*. */
85     uint8_t pad[6];
86 };
87 OFP_ASSERT(sizeof(struct nx_action_header) == 16);
88
89 /* Status bits for NXT_COMMAND_REPLY. */
90 enum {
91     NXT_STATUS_EXITED = 1 << 31,   /* Exited normally. */
92     NXT_STATUS_SIGNALED = 1 << 30, /* Exited due to signal. */
93     NXT_STATUS_UNKNOWN = 1 << 29,  /* Exited for unknown reason. */
94     NXT_STATUS_COREDUMP = 1 << 28, /* Exited with core dump. */
95     NXT_STATUS_ERROR = 1 << 27,    /* Command could not be executed. */
96     NXT_STATUS_STARTED = 1 << 26,  /* Command was started. */
97     NXT_STATUS_EXITSTATUS = 0xff,  /* Exit code mask if NXT_STATUS_EXITED. */
98     NXT_STATUS_TERMSIG = 0xff,     /* Signal number if NXT_STATUS_SIGNALED. */
99 };
100
101 /* NXT_COMMAND_REPLY. */
102 struct nx_command_reply {
103     struct nicira_header nxh;
104     uint32_t status;            /* Status bits defined above. */
105     /* Followed by any number of bytes of process output. */
106 };
107 OFP_ASSERT(sizeof(struct nx_command_reply) == 20);
108
109 #endif /* openflow/nicira-ext.h */