]> The Tcpdump Group git mirrors - tcpdump/blob - openflow.h
CI: Add warning exemptions for Sun C (suncc-5.14) on Solaris 10
[tcpdump] / openflow.h
1 /*
2 * Copyright (c) 2013 The TCPDUMP project
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 *
14 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
15 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
16 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
17 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
18 * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
20 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
22 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
24 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25 * POSSIBILITY OF SUCH DAMAGE.
26 */
27
28 /* OpenFlow: protocol between controller and datapath. */
29
30 /* for netdissect_options */
31 #include "netdissect.h"
32
33 #define OF_FWD(n) { \
34 cp += (n); \
35 len -= (n); \
36 }
37
38 #define OF_CHK_FWD(n) { \
39 ND_TCHECK_LEN(cp, (n)); \
40 cp += (n); \
41 len -= (n); \
42 }
43
44 #define OF_VER_1_0 0x01U
45 #define OF_VER_1_1 0x02U
46 #define OF_VER_1_2 0x03U
47 #define OF_VER_1_3 0x04U
48 #define OF_VER_1_4 0x05U
49 #define OF_VER_1_5 0x06U
50
51 #define OF_HEADER_FIXLEN 8U
52
53 #define ONF_EXP_ONF 0x4f4e4600
54 #define ONF_EXP_BUTE 0xff000001
55 #define ONF_EXP_NOVIFLOW 0xff000002
56 #define ONF_EXP_L3 0xff000003
57 #define ONF_EXP_L4L7 0xff000004
58 #define ONF_EXP_WMOB 0xff000005
59 #define ONF_EXP_FABS 0xff000006
60 #define ONF_EXP_OTRANS 0xff000007
61 #define ONF_EXP_NBLNCTU 0xff000008
62 #define ONF_EXP_MPCE 0xff000009
63 #define ONF_EXP_MPLSTPSPTN 0xff00000a
64 extern const struct tok onf_exp_str[];
65
66 extern const char * of_vendor_name(const uint32_t);
67 extern void of_bitmap_print(netdissect_options *ndo,
68 const struct tok *, const uint32_t, const uint32_t);
69 extern void of_data_print(netdissect_options *ndo,
70 const u_char *, const u_int);
71
72 /*
73 * Routines to handle various versions of OpenFlow.
74 */
75
76 struct of_msgtypeinfo {
77 /* Should not be NULL. */
78 const char *name;
79 /* May be NULL to mean "message body printing is not implemented". */
80 void (*decoder)(netdissect_options *ndo, const u_char *, const u_int);
81 enum {
82 REQ_NONE, /* Message body length may be anything. */
83 REQ_FIXLEN, /* Message body length must be == req_value. */
84 REQ_MINLEN, /* Message body length must be >= req_value. */
85 } req_what;
86 uint16_t req_value;
87 };
88
89 extern const struct of_msgtypeinfo *of10_identify_msgtype(const uint8_t);
90 extern const struct of_msgtypeinfo *of13_identify_msgtype(const uint8_t);