blob: aab1668451b3ec5deeca281c54dc12ad8b96309d [file] [log] [blame]
Jonathan Hart44bdbfc2020-04-14 17:45:47 -07001/*
2 * Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
3 * Copyright (c) 2011, 2012 Open Networking Foundation
4 * Copyright 2013, Big Switch Networks, Inc. This library was generated by the LoxiGen Compiler.
5 * Copyright 2018, Red Hat, Inc.
6 */
7// Automatically generated by LOXI from template const.go
8// Do not modify
9
10package of12
11
12import (
13 "fmt"
14 "strings"
15)
16
17const (
18 // Identifiers from group macro_definitions
19 MaxTableNameLen = 32 // OFP_MAX_TABLE_NAME_LEN
20 MaxPortNameLen = 16 // OFP_MAX_PORT_NAME_LEN
21 TCPPort = 6653 // OFP_TCP_PORT
22 SSLPort = 6653 // OFP_SSL_PORT
23 EthAlen = 6 // OFP_ETH_ALEN
24 DefaultMissSendLen = 128 // OFP_DEFAULT_MISS_SEND_LEN
25 VLANNone = 0 // OFP_VLAN_NONE
26 FlowPermanent = 0 // OFP_FLOW_PERMANENT
27 DefaultPriority = 32768 // OFP_DEFAULT_PRIORITY
28 NoBuffer = 4294967295 // OFP_NO_BUFFER
29 DescStrLen = 256 // DESC_STR_LEN
30 SerialNumLen = 32 // SERIAL_NUM_LEN
31 OFPQAll = 4294967295 // OFPQ_ALL
32 OFPQMinRateUncfg = 65535 // OFPQ_MIN_RATE_UNCFG
33 OFPQMaxRateUncfg = 65535 // OFPQ_MAX_RATE_UNCFG
34)
35
36const (
37 // Identifiers from group nx_action_controller2_prop_type
38 Nxac2PtMaxLen = 0 // NXAC2PT_MAX_LEN
39 Nxac2PtControllerID = 1 // NXAC2PT_CONTROLLER_ID
40 Nxac2PtReason = 2 // NXAC2PT_REASON
41 Nxac2PtUserdata = 3 // NXAC2PT_USERDATA
42 Nxac2PtPause = 4 // NXAC2PT_PAUSE
43 Nxac2PtMeterID = 5 // NXAC2PT_METER_ID
44)
45
46type NxActionController2PropType uint16
47
48func (self NxActionController2PropType) MarshalJSON() ([]byte, error) {
49 return []byte(fmt.Sprintf("%d", self)), nil
50}
51
52const (
53 // Identifiers from group nx_bd_algorithms
54 NxBdAlgActiveBackup = 0 // NX_BD_ALG_ACTIVE_BACKUP
55 NxBdAlgHrw = 1 // NX_BD_ALG_HRW
56)
57
58type NxBdAlgorithms uint16
59
60func (self NxBdAlgorithms) MarshalJSON() ([]byte, error) {
61 return []byte(fmt.Sprintf("\"%s\"", self)), nil
62}
63
64func (self NxBdAlgorithms) String() string {
65 switch self {
66 case NxBdAlgActiveBackup:
67 return "active_backup"
68 case NxBdAlgHrw:
69 return "hrw"
70 default:
71 return fmt.Sprintf("%d", self)
72 }
73}
74
75const (
76 // Identifiers from group nx_conntrack_flags
77 NxCtFCommit = 1 // NX_CT_F_COMMIT
78 NxCtFForce = 2 // NX_CT_F_FORCE
79)
80
81type NxConntrackFlags uint16
82
83func (self NxConntrackFlags) MarshalJSON() ([]byte, error) {
84 var flags []string
85 if self&NxCtFCommit == NxCtFCommit {
86 flags = append(flags, "\"Commit\": true")
87 }
88 if self&NxCtFForce == NxCtFForce {
89 flags = append(flags, "\"Force\": true")
90 }
91 return []byte("{" + strings.Join(flags, ", ") + "}"), nil
92}
93
94const (
95 // Identifiers from group nx_flow_monitor_flags
96 NxfmfInitial = 1 // NXFMF_INITIAL
97 NxfmfAdd = 2 // NXFMF_ADD
98 NxfmfDelete = 4 // NXFMF_DELETE
99 NxfmfModify = 8 // NXFMF_MODIFY
100 NxfmfActions = 16 // NXFMF_ACTIONS
101 NxfmfOwn = 32 // NXFMF_OWN
102)
103
104type NxFlowMonitorFlags uint16
105
106func (self NxFlowMonitorFlags) MarshalJSON() ([]byte, error) {
107 var flags []string
108 if self&NxfmfInitial == NxfmfInitial {
109 flags = append(flags, "\"Initial\": true")
110 }
111 if self&NxfmfAdd == NxfmfAdd {
112 flags = append(flags, "\"Add\": true")
113 }
114 if self&NxfmfDelete == NxfmfDelete {
115 flags = append(flags, "\"Delete\": true")
116 }
117 if self&NxfmfModify == NxfmfModify {
118 flags = append(flags, "\"Modify\": true")
119 }
120 if self&NxfmfActions == NxfmfActions {
121 flags = append(flags, "\"Actions\": true")
122 }
123 if self&NxfmfOwn == NxfmfOwn {
124 flags = append(flags, "\"Own\": true")
125 }
126 return []byte("{" + strings.Join(flags, ", ") + "}"), nil
127}
128
129const (
130 // Identifiers from group nx_hash_fields
131 NxHashFieldsEthSrc = 0 // NX_HASH_FIELDS_ETH_SRC
132 NxHashFieldsSymmetricL4 = 1 // NX_HASH_FIELDS_SYMMETRIC_L4
133 NxHashFieldsSymmetricL3L4 = 2 // NX_HASH_FIELDS_SYMMETRIC_L3L4
134 NxHashFieldsSymmetricL3L4Udp = 3 // NX_HASH_FIELDS_SYMMETRIC_L3L4_UDP
135 NxHashFieldsNwSrc = 4 // NX_HASH_FIELDS_NW_SRC
136 NxHashFieldsNwDst = 5 // NX_HASH_FIELDS_NW_DST
137 NxHashFieldsSymmetricL3 = 6 // NX_HASH_FIELDS_SYMMETRIC_L3
138)
139
140type NxHashFields uint16
141
142func (self NxHashFields) MarshalJSON() ([]byte, error) {
143 return []byte(fmt.Sprintf("\"%s\"", self)), nil
144}
145
146func (self NxHashFields) String() string {
147 switch self {
148 case NxHashFieldsEthSrc:
149 return "eth_src"
150 case NxHashFieldsSymmetricL4:
151 return "symmetric_l4"
152 case NxHashFieldsSymmetricL3L4:
153 return "symmetric_l3l4"
154 case NxHashFieldsSymmetricL3L4Udp:
155 return "symmetric_l3l4_udp"
156 case NxHashFieldsNwSrc:
157 return "nw_src"
158 case NxHashFieldsNwDst:
159 return "nw_dst"
160 case NxHashFieldsSymmetricL3:
161 return "symmetric_l3"
162 default:
163 return fmt.Sprintf("%d", self)
164 }
165}
166
167const (
168 // Identifiers from group nx_mp_algorithm
169 NxMpAlgModuloN = 0 // NX_MP_ALG_MODULO_N
170 NxMpAlgHashThreshold = 1 // NX_MP_ALG_HASH_THRESHOLD
171 NxMpAlgHrw = 2 // NX_MP_ALG_HRW
172 NxMpAlgIterHash = 3 // NX_MP_ALG_ITER_HASH
173)
174
175type NxMpAlgorithm uint16
176
177func (self NxMpAlgorithm) MarshalJSON() ([]byte, error) {
178 return []byte(fmt.Sprintf("\"%s\"", self)), nil
179}
180
181func (self NxMpAlgorithm) String() string {
182 switch self {
183 case NxMpAlgModuloN:
184 return "modulo_n"
185 case NxMpAlgHashThreshold:
186 return "hash_threshold"
187 case NxMpAlgHrw:
188 return "hrw"
189 case NxMpAlgIterHash:
190 return "iter_hash"
191 default:
192 return fmt.Sprintf("%d", self)
193 }
194}
195
196const (
197 // Identifiers from group of_action_nx_bundle_slave_type
198 NxmOfInPort = 2 // NXM_OF_IN_PORT
199 NxmOfJustThereToDefinePrefix = 10000 // NXM_OF_JUST_THERE_TO_DEFINE_PREFIX
200)
201
202type ActionNxBundleSlaveType uint32
203
204func (self ActionNxBundleSlaveType) MarshalJSON() ([]byte, error) {
205 return []byte(fmt.Sprintf("\"%s\"", self)), nil
206}
207
208func (self ActionNxBundleSlaveType) String() string {
209 switch self {
210 case NxmOfInPort:
211 return "in_port"
212 case NxmOfJustThereToDefinePrefix:
213 return "just_there_to_define_prefix"
214 default:
215 return fmt.Sprintf("%d", self)
216 }
217}
218
219const (
220 // Identifiers from group of_bsn_pdu_slot_num
221 BsnPduSlotNumAny = 255 // BSN_PDU_SLOT_NUM_ANY
222)
223
224type BsnPduSlotNum uint8
225
226func (self BsnPduSlotNum) MarshalJSON() ([]byte, error) {
227 return []byte(fmt.Sprintf("%d", self)), nil
228}
229
230const (
231 // Identifiers from group of_nx_nat_range
232 NxNatRangeIpv4Min = 1 // NX_NAT_RANGE_IPV4_MIN
233 NxNatRangeIpv4Max = 2 // NX_NAT_RANGE_IPV4_MAX
234 NxNatRangeIpv6Min = 4 // NX_NAT_RANGE_IPV6_MIN
235 NxNatRangeIpv6Max = 8 // NX_NAT_RANGE_IPV6_MAX
236 NxNatRangeProtoMin = 16 // NX_NAT_RANGE_PROTO_MIN
237 NxNatRangeProtoMax = 32 // NX_NAT_RANGE_PROTO_MAX
238)
239
240type NxNatRange uint16
241
242func (self NxNatRange) MarshalJSON() ([]byte, error) {
243 var flags []string
244 if self&NxNatRangeIpv4Min == NxNatRangeIpv4Min {
245 flags = append(flags, "\"Ipv4Min\": true")
246 }
247 if self&NxNatRangeIpv4Max == NxNatRangeIpv4Max {
248 flags = append(flags, "\"Ipv4Max\": true")
249 }
250 if self&NxNatRangeIpv6Min == NxNatRangeIpv6Min {
251 flags = append(flags, "\"Ipv6Min\": true")
252 }
253 if self&NxNatRangeIpv6Max == NxNatRangeIpv6Max {
254 flags = append(flags, "\"Ipv6Max\": true")
255 }
256 if self&NxNatRangeProtoMin == NxNatRangeProtoMin {
257 flags = append(flags, "\"ProtoMin\": true")
258 }
259 if self&NxNatRangeProtoMax == NxNatRangeProtoMax {
260 flags = append(flags, "\"ProtoMax\": true")
261 }
262 return []byte("{" + strings.Join(flags, ", ") + "}"), nil
263}
264
265const (
266 // Identifiers from group ofp_action_type
267 OFPATOutput = 0 // OFPAT_OUTPUT
268 OFPATCopyTtlOut = 11 // OFPAT_COPY_TTL_OUT
269 OFPATCopyTtlIn = 12 // OFPAT_COPY_TTL_IN
270 OFPATSetMplsTtl = 15 // OFPAT_SET_MPLS_TTL
271 OFPATDecMplsTtl = 16 // OFPAT_DEC_MPLS_TTL
272 OFPATPushVLAN = 17 // OFPAT_PUSH_VLAN
273 OFPATPopVLAN = 18 // OFPAT_POP_VLAN
274 OFPATPushMpls = 19 // OFPAT_PUSH_MPLS
275 OFPATPopMpls = 20 // OFPAT_POP_MPLS
276 OFPATSetQueue = 21 // OFPAT_SET_QUEUE
277 OFPATGroup = 22 // OFPAT_GROUP
278 OFPATSetNwTtl = 23 // OFPAT_SET_NW_TTL
279 OFPATDecNwTtl = 24 // OFPAT_DEC_NW_TTL
280 OFPATSetField = 25 // OFPAT_SET_FIELD
281 OFPATExperimenter = 65535 // OFPAT_EXPERIMENTER
282)
283
284type ActionType uint16
285
286func (self ActionType) MarshalJSON() ([]byte, error) {
287 return []byte(fmt.Sprintf("%d", self)), nil
288}
289
290const (
291 // Identifiers from group ofp_bad_action_code
292 OFPBACBadType = 0 // OFPBAC_BAD_TYPE
293 OFPBACBadLen = 1 // OFPBAC_BAD_LEN
294 OFPBACBadExperimenter = 2 // OFPBAC_BAD_EXPERIMENTER
295 OFPBACBadExperimenterType = 3 // OFPBAC_BAD_EXPERIMENTER_TYPE
296 OFPBACBadOutPort = 4 // OFPBAC_BAD_OUT_PORT
297 OFPBACBadArgument = 5 // OFPBAC_BAD_ARGUMENT
298 OFPBACEperm = 6 // OFPBAC_EPERM
299 OFPBACTooMany = 7 // OFPBAC_TOO_MANY
300 OFPBACBadQueue = 8 // OFPBAC_BAD_QUEUE
301 OFPBACBadOutGroup = 9 // OFPBAC_BAD_OUT_GROUP
302 OFPBACMatchInconsistent = 10 // OFPBAC_MATCH_INCONSISTENT
303 OFPBACUnsupportedOrder = 11 // OFPBAC_UNSUPPORTED_ORDER
304 OFPBACBadTag = 12 // OFPBAC_BAD_TAG
305 OFPBACBadSetType = 13 // OFPBAC_BAD_SET_TYPE
306 OFPBACBadSetLen = 14 // OFPBAC_BAD_SET_LEN
307 OFPBACBadSetArgument = 15 // OFPBAC_BAD_SET_ARGUMENT
308)
309
310type BadActionCode uint16
311
312func (self BadActionCode) MarshalJSON() ([]byte, error) {
313 return []byte(fmt.Sprintf("%d", self)), nil
314}
315
316const (
317 // Identifiers from group ofp_bad_instruction_code
318 OFPBICUnknownInst = 0 // OFPBIC_UNKNOWN_INST
319 OFPBICUnsupInst = 1 // OFPBIC_UNSUP_INST
320 OFPBICBadTableID = 2 // OFPBIC_BAD_TABLE_ID
321 OFPBICUnsupMetadata = 3 // OFPBIC_UNSUP_METADATA
322 OFPBICUnsupMetadataMask = 4 // OFPBIC_UNSUP_METADATA_MASK
323 OFPBICBadExperimenter = 5 // OFPBIC_BAD_EXPERIMENTER
324 OFPBICBadExperimenterType = 6 // OFPBIC_BAD_EXPERIMENTER_TYPE
325 OFPBICBadLen = 7 // OFPBIC_BAD_LEN
326 OFPBICEperm = 8 // OFPBIC_EPERM
327)
328
329type BadInstructionCode uint16
330
331func (self BadInstructionCode) MarshalJSON() ([]byte, error) {
332 return []byte(fmt.Sprintf("%d", self)), nil
333}
334
335const (
336 // Identifiers from group ofp_bad_match_code
337 OFPBMCBadType = 0 // OFPBMC_BAD_TYPE
338 OFPBMCBadLen = 1 // OFPBMC_BAD_LEN
339 OFPBMCBadTag = 2 // OFPBMC_BAD_TAG
340 OFPBMCBadDlAddrMask = 3 // OFPBMC_BAD_DL_ADDR_MASK
341 OFPBMCBadNwAddrMask = 4 // OFPBMC_BAD_NW_ADDR_MASK
342 OFPBMCBadWildcards = 5 // OFPBMC_BAD_WILDCARDS
343 OFPBMCBadField = 6 // OFPBMC_BAD_FIELD
344 OFPBMCBadValue = 7 // OFPBMC_BAD_VALUE
345 OFPBMCBadMask = 8 // OFPBMC_BAD_MASK
346 OFPBMCBadPrereq = 9 // OFPBMC_BAD_PREREQ
347 OFPBMCDupField = 10 // OFPBMC_DUP_FIELD
348 OFPBMCEperm = 11 // OFPBMC_EPERM
349)
350
351type BadMatchCode uint16
352
353func (self BadMatchCode) MarshalJSON() ([]byte, error) {
354 return []byte(fmt.Sprintf("%d", self)), nil
355}
356
357const (
358 // Identifiers from group ofp_bad_request_code
359 OFPBRCBadVersion = 0 // OFPBRC_BAD_VERSION
360 OFPBRCBadType = 1 // OFPBRC_BAD_TYPE
361 OFPBRCBadStat = 2 // OFPBRC_BAD_STAT
362 OFPBRCBadExperimenter = 3 // OFPBRC_BAD_EXPERIMENTER
363 OFPBRCBadExperimenterType = 4 // OFPBRC_BAD_EXPERIMENTER_TYPE
364 OFPBRCEperm = 5 // OFPBRC_EPERM
365 OFPBRCBadLen = 6 // OFPBRC_BAD_LEN
366 OFPBRCBufferEmpty = 7 // OFPBRC_BUFFER_EMPTY
367 OFPBRCBufferUnknown = 8 // OFPBRC_BUFFER_UNKNOWN
368 OFPBRCBadTableID = 9 // OFPBRC_BAD_TABLE_ID
369 OFPBRCIsSlave = 10 // OFPBRC_IS_SLAVE
370 OFPBRCBadPort = 11 // OFPBRC_BAD_PORT
371 OFPBRCBadPacket = 12 // OFPBRC_BAD_PACKET
372)
373
374type BadRequestCode uint16
375
376func (self BadRequestCode) MarshalJSON() ([]byte, error) {
377 return []byte(fmt.Sprintf("%d", self)), nil
378}
379
380const (
381 // Identifiers from group ofp_bsn_tcp_flag
382 BSNTCPFlagFin = 1 // OFP_BSN_TCP_FLAG_FIN
383 BSNTCPFlagSyn = 2 // OFP_BSN_TCP_FLAG_SYN
384 BSNTCPFlagRst = 4 // OFP_BSN_TCP_FLAG_RST
385 BSNTCPFlagPsh = 8 // OFP_BSN_TCP_FLAG_PSH
386 BSNTCPFlagAck = 16 // OFP_BSN_TCP_FLAG_ACK
387 BSNTCPFlagUrg = 32 // OFP_BSN_TCP_FLAG_URG
388 BSNTCPFlagEce = 64 // OFP_BSN_TCP_FLAG_ECE
389 BSNTCPFlagCwr = 128 // OFP_BSN_TCP_FLAG_CWR
390 BSNTCPFlagNs = 256 // OFP_BSN_TCP_FLAG_NS
391)
392
393type BsnTcpFlag uint16
394
395func (self BsnTcpFlag) MarshalJSON() ([]byte, error) {
396 var flags []string
397 if self&BSNTCPFlagFin == BSNTCPFlagFin {
398 flags = append(flags, "\"Fin\": true")
399 }
400 if self&BSNTCPFlagSyn == BSNTCPFlagSyn {
401 flags = append(flags, "\"Syn\": true")
402 }
403 if self&BSNTCPFlagRst == BSNTCPFlagRst {
404 flags = append(flags, "\"Rst\": true")
405 }
406 if self&BSNTCPFlagPsh == BSNTCPFlagPsh {
407 flags = append(flags, "\"Psh\": true")
408 }
409 if self&BSNTCPFlagAck == BSNTCPFlagAck {
410 flags = append(flags, "\"Ack\": true")
411 }
412 if self&BSNTCPFlagUrg == BSNTCPFlagUrg {
413 flags = append(flags, "\"Urg\": true")
414 }
415 if self&BSNTCPFlagEce == BSNTCPFlagEce {
416 flags = append(flags, "\"Ece\": true")
417 }
418 if self&BSNTCPFlagCwr == BSNTCPFlagCwr {
419 flags = append(flags, "\"Cwr\": true")
420 }
421 if self&BSNTCPFlagNs == BSNTCPFlagNs {
422 flags = append(flags, "\"Ns\": true")
423 }
424 return []byte("{" + strings.Join(flags, ", ") + "}"), nil
425}
426
427const (
428 // Identifiers from group ofp_bsn_vport_l2gre_flags
429 OFBSNVportL2GreLocalMACIsValid = 1 // OF_BSN_VPORT_L2GRE_LOCAL_MAC_IS_VALID
430 OFBSNVportL2GreDSCPAssign = 2 // OF_BSN_VPORT_L2GRE_DSCP_ASSIGN
431 OFBSNVportL2GreDSCPCopy = 4 // OF_BSN_VPORT_L2GRE_DSCP_COPY
432 OFBSNVportL2GreLoopbackIsValid = 8 // OF_BSN_VPORT_L2GRE_LOOPBACK_IS_VALID
433 OFBSNVportL2GreRateLimitIsValid = 16 // OF_BSN_VPORT_L2GRE_RATE_LIMIT_IS_VALID
434)
435
436type BsnVportL2GreFlags uint32
437
438func (self BsnVportL2GreFlags) MarshalJSON() ([]byte, error) {
439 var flags []string
440 if self&OFBSNVportL2GreLocalMACIsValid == OFBSNVportL2GreLocalMACIsValid {
441 flags = append(flags, "\"LocalMACIsValid\": true")
442 }
443 if self&OFBSNVportL2GreDSCPAssign == OFBSNVportL2GreDSCPAssign {
444 flags = append(flags, "\"DscpAssign\": true")
445 }
446 if self&OFBSNVportL2GreDSCPCopy == OFBSNVportL2GreDSCPCopy {
447 flags = append(flags, "\"DscpCopy\": true")
448 }
449 if self&OFBSNVportL2GreLoopbackIsValid == OFBSNVportL2GreLoopbackIsValid {
450 flags = append(flags, "\"LoopbackIsValid\": true")
451 }
452 if self&OFBSNVportL2GreRateLimitIsValid == OFBSNVportL2GreRateLimitIsValid {
453 flags = append(flags, "\"RateLimitIsValid\": true")
454 }
455 return []byte("{" + strings.Join(flags, ", ") + "}"), nil
456}
457
458const (
459 // Identifiers from group ofp_bsn_vport_q_in_q_untagged
460 OFBSNVportQInQUntagged = 65535 // OF_BSN_VPORT_Q_IN_Q_UNTAGGED
461)
462
463type BsnVportQInQUntagged uint16
464
465func (self BsnVportQInQUntagged) MarshalJSON() ([]byte, error) {
466 return []byte(fmt.Sprintf("%d", self)), nil
467}
468
469const (
470 // Identifiers from group ofp_bsn_vport_status
471 OFBSNVportStatusOk = 0 // OF_BSN_VPORT_STATUS_OK
472 OFBSNVportStatusFailed = 1 // OF_BSN_VPORT_STATUS_FAILED
473)
474
475const (
476 // Identifiers from group ofp_capabilities
477 OFPCFlowStats = 1 // OFPC_FLOW_STATS
478 OFPCTableStats = 2 // OFPC_TABLE_STATS
479 OFPCPortStats = 4 // OFPC_PORT_STATS
480 OFPCGroupStats = 8 // OFPC_GROUP_STATS
481 OFPCIpReasm = 32 // OFPC_IP_REASM
482 OFPCQueueStats = 64 // OFPC_QUEUE_STATS
483 OFPCPortBlocked = 256 // OFPC_PORT_BLOCKED
484)
485
486type Capabilities uint32
487
488func (self Capabilities) MarshalJSON() ([]byte, error) {
489 var flags []string
490 if self&OFPCFlowStats == OFPCFlowStats {
491 flags = append(flags, "\"FlowStats\": true")
492 }
493 if self&OFPCTableStats == OFPCTableStats {
494 flags = append(flags, "\"TableStats\": true")
495 }
496 if self&OFPCPortStats == OFPCPortStats {
497 flags = append(flags, "\"PortStats\": true")
498 }
499 if self&OFPCGroupStats == OFPCGroupStats {
500 flags = append(flags, "\"GroupStats\": true")
501 }
502 if self&OFPCIpReasm == OFPCIpReasm {
503 flags = append(flags, "\"IpReasm\": true")
504 }
505 if self&OFPCQueueStats == OFPCQueueStats {
506 flags = append(flags, "\"QueueStats\": true")
507 }
508 if self&OFPCPortBlocked == OFPCPortBlocked {
509 flags = append(flags, "\"PortBlocked\": true")
510 }
511 return []byte("{" + strings.Join(flags, ", ") + "}"), nil
512}
513
514const (
515 // Identifiers from group ofp_config_flags
516 OFPCFragNormal = 0 // OFPC_FRAG_NORMAL
517 OFPCFragDrop = 1 // OFPC_FRAG_DROP
518 OFPCFragReasm = 2 // OFPC_FRAG_REASM
519 OFPCFragMask = 3 // OFPC_FRAG_MASK
520 OFPCInvalidTtlToController = 4 // OFPC_INVALID_TTL_TO_CONTROLLER
521)
522
523type ConfigFlags uint16
524
525func (self ConfigFlags) MarshalJSON() ([]byte, error) {
526 var flags []string
527 if self&OFPCFragNormal == OFPCFragNormal {
528 flags = append(flags, "\"FragNormal\": true")
529 }
530 if self&OFPCFragDrop == OFPCFragDrop {
531 flags = append(flags, "\"FragDrop\": true")
532 }
533 if self&OFPCFragReasm == OFPCFragReasm {
534 flags = append(flags, "\"FragReasm\": true")
535 }
536 if self&OFPCFragMask == OFPCFragMask {
537 flags = append(flags, "\"FragMask\": true")
538 }
539 if self&OFPCInvalidTtlToController == OFPCInvalidTtlToController {
540 flags = append(flags, "\"InvalidTtlToController\": true")
541 }
542 return []byte("{" + strings.Join(flags, ", ") + "}"), nil
543}
544
545const (
546 // Identifiers from group ofp_controller_max_len
547 OFPCMLMax = 65509 // OFPCML_MAX
548 OFPCMLNoBuffer = 65535 // OFPCML_NO_BUFFER
549)
550
551type ControllerMaxLen uint16
552
553func (self ControllerMaxLen) MarshalJSON() ([]byte, error) {
554 return []byte(fmt.Sprintf("%d", self)), nil
555}
556
557const (
558 // Identifiers from group ofp_controller_role
559 OFPCRRoleNochange = 0 // OFPCR_ROLE_NOCHANGE
560 OFPCRRoleEqual = 1 // OFPCR_ROLE_EQUAL
561 OFPCRRoleMaster = 2 // OFPCR_ROLE_MASTER
562 OFPCRRoleSlave = 3 // OFPCR_ROLE_SLAVE
563)
564
565type ControllerRole uint32
566
567func (self ControllerRole) MarshalJSON() ([]byte, error) {
568 return []byte(fmt.Sprintf("%d", self)), nil
569}
570
571const (
572 // Identifiers from group ofp_cs_states
573 CsNew = 1 // OFP_CS_NEW
574 CsEstablished = 2 // OFP_CS_ESTABLISHED
575 CsRelated = 4 // OFP_CS_RELATED
576 CsReplyDir = 8 // OFP_CS_REPLY_DIR
577 CsInvalid = 16 // OFP_CS_INVALID
578 CsTracked = 32 // OFP_CS_TRACKED
579 CsSrcNat = 64 // OFP_CS_SRC_NAT
580 CsDstNat = 128 // OFP_CS_DST_NAT
581)
582
583type CsStates uint32
584
585func (self CsStates) MarshalJSON() ([]byte, error) {
586 var flags []string
587 if self&CsNew == CsNew {
588 flags = append(flags, "\"New\": true")
589 }
590 if self&CsEstablished == CsEstablished {
591 flags = append(flags, "\"Established\": true")
592 }
593 if self&CsRelated == CsRelated {
594 flags = append(flags, "\"Related\": true")
595 }
596 if self&CsReplyDir == CsReplyDir {
597 flags = append(flags, "\"ReplyDir\": true")
598 }
599 if self&CsInvalid == CsInvalid {
600 flags = append(flags, "\"Invalid\": true")
601 }
602 if self&CsTracked == CsTracked {
603 flags = append(flags, "\"Tracked\": true")
604 }
605 if self&CsSrcNat == CsSrcNat {
606 flags = append(flags, "\"SrcNat\": true")
607 }
608 if self&CsDstNat == CsDstNat {
609 flags = append(flags, "\"DstNat\": true")
610 }
611 return []byte("{" + strings.Join(flags, ", ") + "}"), nil
612}
613
614const (
615 // Identifiers from group ofp_ed_nsh_prop_type
616 OFPPPTPropNshNone = 0 // OFPPPT_PROP_NSH_NONE
617 OFPPPTPropNshMdtype = 1 // OFPPPT_PROP_NSH_MDTYPE
618 OFPPPTPropNshTlv = 2 // OFPPPT_PROP_NSH_TLV
619)
620
621type EdNshPropType uint8
622
623func (self EdNshPropType) MarshalJSON() ([]byte, error) {
624 return []byte(fmt.Sprintf("%d", self)), nil
625}
626
627const (
628 // Identifiers from group ofp_ed_prop_class
629 OFPPPCBasic = 0 // OFPPPC_BASIC
630 OFPPPCMpls = 1 // OFPPPC_MPLS
631 OFPPPCGRE = 2 // OFPPPC_GRE
632 OFPPPCGtp = 3 // OFPPPC_GTP
633 OFPPPCNsh = 4 // OFPPPC_NSH
634 OFPPPCExperimenter = 65535 // OFPPPC_EXPERIMENTER
635)
636
637type EdPropClass uint16
638
639func (self EdPropClass) MarshalJSON() ([]byte, error) {
640 return []byte(fmt.Sprintf("%d", self)), nil
641}
642
643const (
644 // Identifiers from group ofp_error_type
645 OFPETHelloFailed = 0 // OFPET_HELLO_FAILED
646 OFPETBadRequest = 1 // OFPET_BAD_REQUEST
647 OFPETBadAction = 2 // OFPET_BAD_ACTION
648 OFPETBadInstruction = 3 // OFPET_BAD_INSTRUCTION
649 OFPETBadMatch = 4 // OFPET_BAD_MATCH
650 OFPETFlowModFailed = 5 // OFPET_FLOW_MOD_FAILED
651 OFPETGroupModFailed = 6 // OFPET_GROUP_MOD_FAILED
652 OFPETPortModFailed = 7 // OFPET_PORT_MOD_FAILED
653 OFPETTableModFailed = 8 // OFPET_TABLE_MOD_FAILED
654 OFPETQueueOpFailed = 9 // OFPET_QUEUE_OP_FAILED
655 OFPETSwitchConfigFailed = 10 // OFPET_SWITCH_CONFIG_FAILED
656 OFPETRoleRequestFailed = 11 // OFPET_ROLE_REQUEST_FAILED
657 OFPETExperimenter = 65535 // OFPET_EXPERIMENTER
658)
659
660type ErrorType uint16
661
662func (self ErrorType) MarshalJSON() ([]byte, error) {
663 return []byte(fmt.Sprintf("%d", self)), nil
664}
665
666const (
667 // Identifiers from group ofp_ethernet_type
668 EthPLoop = 96 // ETH_P_LOOP
669 EthPPup = 512 // ETH_P_PUP
670 EthPPupat = 513 // ETH_P_PUPAT
671 EthPIp = 2048 // ETH_P_IP
672 EthPX25 = 2053 // ETH_P_X25
673 EthPARP = 2054 // ETH_P_ARP
674 EthPBpq = 2303 // ETH_P_BPQ
675 EthPIeeepup = 2560 // ETH_P_IEEEPUP
676 EthPIeeepupat = 2561 // ETH_P_IEEEPUPAT
677 EthPDec = 24576 // ETH_P_DEC
678 EthPDnaDl = 24577 // ETH_P_DNA_DL
679 EthPDnaRc = 24578 // ETH_P_DNA_RC
680 EthPDnaRt = 24579 // ETH_P_DNA_RT
681 EthPLat = 24580 // ETH_P_LAT
682 EthPDiag = 24581 // ETH_P_DIAG
683 EthPCust = 24582 // ETH_P_CUST
684 EthPSca = 24583 // ETH_P_SCA
685 EthPTeb = 25944 // ETH_P_TEB
686 EthPRarp = 32821 // ETH_P_RARP
687 EthPAtalk = 32923 // ETH_P_ATALK
688 EthPAarp = 33011 // ETH_P_AARP
689 EthP8021Q = 33024 // ETH_P_8021Q
690 EthPIpx = 33079 // ETH_P_IPX
691 EthPIpv6 = 34525 // ETH_P_IPV6
692 EthPPause = 34824 // ETH_P_PAUSE
693 EthPSlow = 34825 // ETH_P_SLOW
694 EthPWccp = 34878 // ETH_P_WCCP
695 EthPPppDisc = 34915 // ETH_P_PPP_DISC
696 EthPPppSes = 34916 // ETH_P_PPP_SES
697 EthPMplsUc = 34887 // ETH_P_MPLS_UC
698 EthPMplsMc = 34888 // ETH_P_MPLS_MC
699 EthPAtmmpoa = 34892 // ETH_P_ATMMPOA
700 EthPAtmfate = 34948 // ETH_P_ATMFATE
701 EthPPae = 34958 // ETH_P_PAE
702 EthPAoe = 34978 // ETH_P_AOE
703 EthPTipc = 35018 // ETH_P_TIPC
704 EthP1588 = 35063 // ETH_P_1588
705 EthPFcoe = 35078 // ETH_P_FCOE
706 EthPFip = 35092 // ETH_P_FIP
707 EthPEdsa = 56026 // ETH_P_EDSA
708)
709
710type EthernetType uint16
711
712func (self EthernetType) MarshalJSON() ([]byte, error) {
713 return []byte(fmt.Sprintf("\"%s\"", self)), nil
714}
715
716func (self EthernetType) String() string {
717 switch self {
718 case EthPLoop:
719 return "loop"
720 case EthPPup:
721 return "pup"
722 case EthPPupat:
723 return "pupat"
724 case EthPIp:
725 return "ip"
726 case EthPX25:
727 return "x25"
728 case EthPARP:
729 return "arp"
730 case EthPBpq:
731 return "bpq"
732 case EthPIeeepup:
733 return "ieeepup"
734 case EthPIeeepupat:
735 return "ieeepupat"
736 case EthPDec:
737 return "dec"
738 case EthPDnaDl:
739 return "dna_dl"
740 case EthPDnaRc:
741 return "dna_rc"
742 case EthPDnaRt:
743 return "dna_rt"
744 case EthPLat:
745 return "lat"
746 case EthPDiag:
747 return "diag"
748 case EthPCust:
749 return "cust"
750 case EthPSca:
751 return "sca"
752 case EthPTeb:
753 return "teb"
754 case EthPRarp:
755 return "rarp"
756 case EthPAtalk:
757 return "atalk"
758 case EthPAarp:
759 return "aarp"
760 case EthP8021Q:
761 return "8021q"
762 case EthPIpx:
763 return "ipx"
764 case EthPIpv6:
765 return "ipv6"
766 case EthPPause:
767 return "pause"
768 case EthPSlow:
769 return "slow"
770 case EthPWccp:
771 return "wccp"
772 case EthPPppDisc:
773 return "ppp_disc"
774 case EthPPppSes:
775 return "ppp_ses"
776 case EthPMplsUc:
777 return "mpls_uc"
778 case EthPMplsMc:
779 return "mpls_mc"
780 case EthPAtmmpoa:
781 return "atmmpoa"
782 case EthPAtmfate:
783 return "atmfate"
784 case EthPPae:
785 return "pae"
786 case EthPAoe:
787 return "aoe"
788 case EthPTipc:
789 return "tipc"
790 case EthP1588:
791 return "1588"
792 case EthPFcoe:
793 return "fcoe"
794 case EthPFip:
795 return "fip"
796 case EthPEdsa:
797 return "edsa"
798 default:
799 return fmt.Sprintf("%d", self)
800 }
801}
802
803const (
804 // Identifiers from group ofp_flow_mod_command
805 OFPFCAdd = 0 // OFPFC_ADD
806 OFPFCModify = 1 // OFPFC_MODIFY
807 OFPFCModifyStrict = 2 // OFPFC_MODIFY_STRICT
808 OFPFCDelete = 3 // OFPFC_DELETE
809 OFPFCDeleteStrict = 4 // OFPFC_DELETE_STRICT
810)
811
812type FlowModCommand uint8
813
814func (self FlowModCommand) MarshalJSON() ([]byte, error) {
815 return []byte(fmt.Sprintf("%d", self)), nil
816}
817
818const (
819 // Identifiers from group ofp_flow_mod_failed_code
820 OFPFMFCUnknown = 0 // OFPFMFC_UNKNOWN
821 OFPFMFCTableFull = 1 // OFPFMFC_TABLE_FULL
822 OFPFMFCBadTableID = 2 // OFPFMFC_BAD_TABLE_ID
823 OFPFMFCOverlap = 3 // OFPFMFC_OVERLAP
824 OFPFMFCEperm = 4 // OFPFMFC_EPERM
825 OFPFMFCBadTimeout = 5 // OFPFMFC_BAD_TIMEOUT
826 OFPFMFCBadCommand = 6 // OFPFMFC_BAD_COMMAND
827 OFPFMFCBadFlags = 7 // OFPFMFC_BAD_FLAGS
828)
829
830type FlowModFailedCode uint16
831
832func (self FlowModFailedCode) MarshalJSON() ([]byte, error) {
833 return []byte(fmt.Sprintf("%d", self)), nil
834}
835
836const (
837 // Identifiers from group ofp_flow_mod_flags
838 OFPFFSendFlowRem = 1 // OFPFF_SEND_FLOW_REM
839 OFPFFCheckOverlap = 2 // OFPFF_CHECK_OVERLAP
840 OFPFFResetCounts = 4 // OFPFF_RESET_COUNTS
841)
842
843type FlowModFlags uint16
844
845func (self FlowModFlags) MarshalJSON() ([]byte, error) {
846 var flags []string
847 if self&OFPFFSendFlowRem == OFPFFSendFlowRem {
848 flags = append(flags, "\"SendFlowRem\": true")
849 }
850 if self&OFPFFCheckOverlap == OFPFFCheckOverlap {
851 flags = append(flags, "\"CheckOverlap\": true")
852 }
853 if self&OFPFFResetCounts == OFPFFResetCounts {
854 flags = append(flags, "\"ResetCounts\": true")
855 }
856 return []byte("{" + strings.Join(flags, ", ") + "}"), nil
857}
858
859const (
860 // Identifiers from group ofp_flow_removed_reason
861 OFPRRIdleTimeout = 0 // OFPRR_IDLE_TIMEOUT
862 OFPRRHardTimeout = 1 // OFPRR_HARD_TIMEOUT
863 OFPRRDelete = 2 // OFPRR_DELETE
864 OFPRRGroupDelete = 3 // OFPRR_GROUP_DELETE
865)
866
867type FlowRemovedReason uint8
868
869func (self FlowRemovedReason) MarshalJSON() ([]byte, error) {
870 return []byte(fmt.Sprintf("%d", self)), nil
871}
872
873const (
874 // Identifiers from group ofp_group
875 OFPGMax = 4294967040 // OFPG_MAX
876 OFPGAll = 4294967292 // OFPG_ALL
877 OFPGAny = 4294967295 // OFPG_ANY
878)
879
880type Group uint32
881
882func (self Group) MarshalJSON() ([]byte, error) {
883 return []byte(fmt.Sprintf("%d", self)), nil
884}
885
886const (
887 // Identifiers from group ofp_group_capabilities
888 OFPGFCSelectWeight = 1 // OFPGFC_SELECT_WEIGHT
889 OFPGFCSelectLiveness = 2 // OFPGFC_SELECT_LIVENESS
890 OFPGFCChaining = 4 // OFPGFC_CHAINING
891 OFPGFCChainingChecks = 8 // OFPGFC_CHAINING_CHECKS
892)
893
894type GroupCapabilities uint32
895
896func (self GroupCapabilities) MarshalJSON() ([]byte, error) {
897 var flags []string
898 if self&OFPGFCSelectWeight == OFPGFCSelectWeight {
899 flags = append(flags, "\"SelectWeight\": true")
900 }
901 if self&OFPGFCSelectLiveness == OFPGFCSelectLiveness {
902 flags = append(flags, "\"SelectLiveness\": true")
903 }
904 if self&OFPGFCChaining == OFPGFCChaining {
905 flags = append(flags, "\"Chaining\": true")
906 }
907 if self&OFPGFCChainingChecks == OFPGFCChainingChecks {
908 flags = append(flags, "\"ChainingChecks\": true")
909 }
910 return []byte("{" + strings.Join(flags, ", ") + "}"), nil
911}
912
913const (
914 // Identifiers from group ofp_group_mod_command
915 OFPGCAdd = 0 // OFPGC_ADD
916 OFPGCModify = 1 // OFPGC_MODIFY
917 OFPGCDelete = 2 // OFPGC_DELETE
918)
919
920type GroupModCommand uint16
921
922func (self GroupModCommand) MarshalJSON() ([]byte, error) {
923 return []byte(fmt.Sprintf("%d", self)), nil
924}
925
926const (
927 // Identifiers from group ofp_group_mod_failed_code
928 OFPGMFCGroupExists = 0 // OFPGMFC_GROUP_EXISTS
929 OFPGMFCInvalidGroup = 1 // OFPGMFC_INVALID_GROUP
930 OFPGMFCWeightUnsupported = 2 // OFPGMFC_WEIGHT_UNSUPPORTED
931 OFPGMFCOutOfGroups = 3 // OFPGMFC_OUT_OF_GROUPS
932 OFPGMFCOutOfBuckets = 4 // OFPGMFC_OUT_OF_BUCKETS
933 OFPGMFCChainingUnsupported = 5 // OFPGMFC_CHAINING_UNSUPPORTED
934 OFPGMFCWatchUnsupported = 6 // OFPGMFC_WATCH_UNSUPPORTED
935 OFPGMFCLoop = 7 // OFPGMFC_LOOP
936 OFPGMFCUnknownGroup = 8 // OFPGMFC_UNKNOWN_GROUP
937 OFPGMFCChainedGroup = 9 // OFPGMFC_CHAINED_GROUP
938 OFPGMFCBadType = 10 // OFPGMFC_BAD_TYPE
939 OFPGMFCBadCommand = 11 // OFPGMFC_BAD_COMMAND
940 OFPGMFCBadBucket = 12 // OFPGMFC_BAD_BUCKET
941 OFPGMFCBadWatch = 13 // OFPGMFC_BAD_WATCH
942 OFPGMFCEperm = 14 // OFPGMFC_EPERM
943)
944
945type GroupModFailedCode uint16
946
947func (self GroupModFailedCode) MarshalJSON() ([]byte, error) {
948 return []byte(fmt.Sprintf("%d", self)), nil
949}
950
951const (
952 // Identifiers from group ofp_group_type
953 OFPGTAll = 0 // OFPGT_ALL
954 OFPGTSelect = 1 // OFPGT_SELECT
955 OFPGTIndirect = 2 // OFPGT_INDIRECT
956 OFPGTFf = 3 // OFPGT_FF
957)
958
959type GroupType uint8
960
961func (self GroupType) MarshalJSON() ([]byte, error) {
962 return []byte(fmt.Sprintf("\"%s\"", self)), nil
963}
964
965func (self GroupType) String() string {
966 switch self {
967 case OFPGTAll:
968 return "all"
969 case OFPGTSelect:
970 return "select"
971 case OFPGTIndirect:
972 return "indirect"
973 case OFPGTFf:
974 return "ff"
975 default:
976 return fmt.Sprintf("%d", self)
977 }
978}
979
980const (
981 // Identifiers from group ofp_hello_failed_code
982 OFPHFCIncompatible = 0 // OFPHFC_INCOMPATIBLE
983 OFPHFCEperm = 1 // OFPHFC_EPERM
984)
985
986type HelloFailedCode uint16
987
988func (self HelloFailedCode) MarshalJSON() ([]byte, error) {
989 return []byte(fmt.Sprintf("%d", self)), nil
990}
991
992const (
993 // Identifiers from group ofp_icmp_type
994 IcmpEchoreply = 0 // ICMP_ECHOREPLY
995 IcmpDestUnreach = 3 // ICMP_DEST_UNREACH
996 IcmpSourceQuench = 4 // ICMP_SOURCE_QUENCH
997 IcmpRedirect = 5 // ICMP_REDIRECT
998 IcmpEcho = 8 // ICMP_ECHO
999 IcmpTimeExceeded = 11 // ICMP_TIME_EXCEEDED
1000 IcmpParameterprob = 12 // ICMP_PARAMETERPROB
1001 IcmpTimestamp = 13 // ICMP_TIMESTAMP
1002 IcmpTimestampreply = 14 // ICMP_TIMESTAMPREPLY
1003 IcmpInfoRequest = 15 // ICMP_INFO_REQUEST
1004 IcmpInfoReply = 16 // ICMP_INFO_REPLY
1005 IcmpAddress = 17 // ICMP_ADDRESS
1006 IcmpAddressreply = 18 // ICMP_ADDRESSREPLY
1007)
1008
1009type IcmpType uint8
1010
1011func (self IcmpType) MarshalJSON() ([]byte, error) {
1012 return []byte(fmt.Sprintf("\"%s\"", self)), nil
1013}
1014
1015func (self IcmpType) String() string {
1016 switch self {
1017 case IcmpEchoreply:
1018 return "echoreply"
1019 case IcmpDestUnreach:
1020 return "dest_unreach"
1021 case IcmpSourceQuench:
1022 return "source_quench"
1023 case IcmpRedirect:
1024 return "redirect"
1025 case IcmpEcho:
1026 return "echo"
1027 case IcmpTimeExceeded:
1028 return "time_exceeded"
1029 case IcmpParameterprob:
1030 return "parameterprob"
1031 case IcmpTimestamp:
1032 return "timestamp"
1033 case IcmpTimestampreply:
1034 return "timestampreply"
1035 case IcmpInfoRequest:
1036 return "info_request"
1037 case IcmpInfoReply:
1038 return "info_reply"
1039 case IcmpAddress:
1040 return "address"
1041 case IcmpAddressreply:
1042 return "addressreply"
1043 default:
1044 return fmt.Sprintf("%d", self)
1045 }
1046}
1047
1048const (
1049 // Identifiers from group ofp_icmpv6_type
1050 Icmpv6EchoRequest = 128 // ICMPV6_ECHO_REQUEST
1051 Icmpv6EchoReply = 129 // ICMPV6_ECHO_REPLY
1052 Icmpv6MgmQuery = 130 // ICMPV6_MGM_QUERY
1053 Icmpv6MgmReport = 131 // ICMPV6_MGM_REPORT
1054 Icmpv6MgmReduction = 132 // ICMPV6_MGM_REDUCTION
1055 Icmpv6NiQuery = 139 // ICMPV6_NI_QUERY
1056 Icmpv6NiReply = 140 // ICMPV6_NI_REPLY
1057 Icmpv6Mld2Report = 143 // ICMPV6_MLD2_REPORT
1058 Icmpv6DhaadRequest = 144 // ICMPV6_DHAAD_REQUEST
1059 Icmpv6DhaadReply = 145 // ICMPV6_DHAAD_REPLY
1060 Icmpv6MobilePrefixSol = 146 // ICMPV6_MOBILE_PREFIX_SOL
1061 Icmpv6MobilePrefixAdv = 147 // ICMPV6_MOBILE_PREFIX_ADV
1062)
1063
1064type Icmpv6Type uint8
1065
1066func (self Icmpv6Type) MarshalJSON() ([]byte, error) {
1067 return []byte(fmt.Sprintf("\"%s\"", self)), nil
1068}
1069
1070func (self Icmpv6Type) String() string {
1071 switch self {
1072 case Icmpv6EchoRequest:
1073 return "echo_request"
1074 case Icmpv6EchoReply:
1075 return "echo_reply"
1076 case Icmpv6MgmQuery:
1077 return "mgm_query"
1078 case Icmpv6MgmReport:
1079 return "mgm_report"
1080 case Icmpv6MgmReduction:
1081 return "mgm_reduction"
1082 case Icmpv6NiQuery:
1083 return "ni_query"
1084 case Icmpv6NiReply:
1085 return "ni_reply"
1086 case Icmpv6Mld2Report:
1087 return "mld2_report"
1088 case Icmpv6DhaadRequest:
1089 return "dhaad_request"
1090 case Icmpv6DhaadReply:
1091 return "dhaad_reply"
1092 case Icmpv6MobilePrefixSol:
1093 return "mobile_prefix_sol"
1094 case Icmpv6MobilePrefixAdv:
1095 return "mobile_prefix_adv"
1096 default:
1097 return fmt.Sprintf("%d", self)
1098 }
1099}
1100
1101const (
1102 // Identifiers from group ofp_instruction_type
1103 OFPITGotoTable = 1 // OFPIT_GOTO_TABLE
1104 OFPITWriteMetadata = 2 // OFPIT_WRITE_METADATA
1105 OFPITWriteActions = 3 // OFPIT_WRITE_ACTIONS
1106 OFPITApplyActions = 4 // OFPIT_APPLY_ACTIONS
1107 OFPITClearActions = 5 // OFPIT_CLEAR_ACTIONS
1108 OFPITExperimenter = 65535 // OFPIT_EXPERIMENTER
1109)
1110
1111type InstructionType uint16
1112
1113func (self InstructionType) MarshalJSON() ([]byte, error) {
1114 var flags []string
1115 if self&OFPITGotoTable == OFPITGotoTable {
1116 flags = append(flags, "\"GotoTable\": true")
1117 }
1118 if self&OFPITWriteMetadata == OFPITWriteMetadata {
1119 flags = append(flags, "\"WriteMetadata\": true")
1120 }
1121 if self&OFPITWriteActions == OFPITWriteActions {
1122 flags = append(flags, "\"WriteActions\": true")
1123 }
1124 if self&OFPITApplyActions == OFPITApplyActions {
1125 flags = append(flags, "\"ApplyActions\": true")
1126 }
1127 if self&OFPITClearActions == OFPITClearActions {
1128 flags = append(flags, "\"ClearActions\": true")
1129 }
1130 if self&OFPITExperimenter == OFPITExperimenter {
1131 flags = append(flags, "\"Experimenter\": true")
1132 }
1133 return []byte("{" + strings.Join(flags, ", ") + "}"), nil
1134}
1135
1136const (
1137 // Identifiers from group ofp_ip_prototype
1138 IpprotoIp = 0 // IPPROTO_IP
1139 IpprotoICMP = 1 // IPPROTO_ICMP
1140 IpprotoIgmp = 2 // IPPROTO_IGMP
1141 IpprotoIpip = 4 // IPPROTO_IPIP
1142 IpprotoTCP = 6 // IPPROTO_TCP
1143 IpprotoEgp = 8 // IPPROTO_EGP
1144 IpprotoPup = 12 // IPPROTO_PUP
1145 IpprotoUdp = 17 // IPPROTO_UDP
1146 IpprotoIdp = 22 // IPPROTO_IDP
1147 IpprotoTp = 29 // IPPROTO_TP
1148 IpprotoDccp = 33 // IPPROTO_DCCP
1149 IpprotoIpv6 = 41 // IPPROTO_IPV6
1150 IpprotoRsvp = 46 // IPPROTO_RSVP
1151 IpprotoGRE = 47 // IPPROTO_GRE
1152 IpprotoEsp = 50 // IPPROTO_ESP
1153 IpprotoAh = 51 // IPPROTO_AH
1154 IpprotoMtp = 92 // IPPROTO_MTP
1155 IpprotoBeetph = 94 // IPPROTO_BEETPH
1156 IpprotoEncap = 98 // IPPROTO_ENCAP
1157 IpprotoPim = 103 // IPPROTO_PIM
1158 IpprotoComp = 108 // IPPROTO_COMP
1159 IpprotoSctp = 132 // IPPROTO_SCTP
1160 IpprotoUdplite = 136 // IPPROTO_UDPLITE
1161 IpprotoMpls = 137 // IPPROTO_MPLS
1162 IpprotoRaw = 255 // IPPROTO_RAW
1163 IpprotoRouting = 43 // IPPROTO_ROUTING
1164 IpprotoFragment = 44 // IPPROTO_FRAGMENT
1165 IpprotoIcmpv6 = 58 // IPPROTO_ICMPV6
1166 IpprotoNone = 59 // IPPROTO_NONE
1167 IpprotoDstopts = 60 // IPPROTO_DSTOPTS
1168 IpprotoMh = 135 // IPPROTO_MH
1169 IpprotoL2Tp = 115 // IPPROTO_L2TP
1170)
1171
1172type IpPrototype uint8
1173
1174func (self IpPrototype) MarshalJSON() ([]byte, error) {
1175 return []byte(fmt.Sprintf("\"%s\"", self)), nil
1176}
1177
1178func (self IpPrototype) String() string {
1179 switch self {
1180 case IpprotoIp:
1181 return "ip"
1182 case IpprotoICMP:
1183 return "icmp"
1184 case IpprotoIgmp:
1185 return "igmp"
1186 case IpprotoIpip:
1187 return "ipip"
1188 case IpprotoTCP:
1189 return "tcp"
1190 case IpprotoEgp:
1191 return "egp"
1192 case IpprotoPup:
1193 return "pup"
1194 case IpprotoUdp:
1195 return "udp"
1196 case IpprotoIdp:
1197 return "idp"
1198 case IpprotoTp:
1199 return "tp"
1200 case IpprotoDccp:
1201 return "dccp"
1202 case IpprotoIpv6:
1203 return "ipv6"
1204 case IpprotoRsvp:
1205 return "rsvp"
1206 case IpprotoGRE:
1207 return "gre"
1208 case IpprotoEsp:
1209 return "esp"
1210 case IpprotoAh:
1211 return "ah"
1212 case IpprotoMtp:
1213 return "mtp"
1214 case IpprotoBeetph:
1215 return "beetph"
1216 case IpprotoEncap:
1217 return "encap"
1218 case IpprotoPim:
1219 return "pim"
1220 case IpprotoComp:
1221 return "comp"
1222 case IpprotoSctp:
1223 return "sctp"
1224 case IpprotoUdplite:
1225 return "udplite"
1226 case IpprotoMpls:
1227 return "mpls"
1228 case IpprotoRaw:
1229 return "raw"
1230 case IpprotoRouting:
1231 return "routing"
1232 case IpprotoFragment:
1233 return "fragment"
1234 case IpprotoIcmpv6:
1235 return "icmpv6"
1236 case IpprotoNone:
1237 return "none"
1238 case IpprotoDstopts:
1239 return "dstopts"
1240 case IpprotoMh:
1241 return "mh"
1242 case IpprotoL2Tp:
1243 return "l2tp"
1244 default:
1245 return fmt.Sprintf("%d", self)
1246 }
1247}
1248
1249const (
1250 // Identifiers from group ofp_match_type
1251 OFPMTStandard = 0 // OFPMT_STANDARD
1252 OFPMTOXM = 1 // OFPMT_OXM
1253)
1254
1255type MatchType uint16
1256
1257func (self MatchType) MarshalJSON() ([]byte, error) {
1258 return []byte(fmt.Sprintf("%d", self)), nil
1259}
1260
1261const (
1262 // Identifiers from group ofp_ovs_tcp_flag
1263 OvsTCPFlagFin = 1 // OFP_OVS_TCP_FLAG_FIN
1264 OvsTCPFlagSyn = 2 // OFP_OVS_TCP_FLAG_SYN
1265 OvsTCPFlagRst = 4 // OFP_OVS_TCP_FLAG_RST
1266 OvsTCPFlagPsh = 8 // OFP_OVS_TCP_FLAG_PSH
1267 OvsTCPFlagAck = 16 // OFP_OVS_TCP_FLAG_ACK
1268 OvsTCPFlagUrg = 32 // OFP_OVS_TCP_FLAG_URG
1269 OvsTCPFlagEce = 64 // OFP_OVS_TCP_FLAG_ECE
1270 OvsTCPFlagCwr = 128 // OFP_OVS_TCP_FLAG_CWR
1271 OvsTCPFlagNs = 256 // OFP_OVS_TCP_FLAG_NS
1272)
1273
1274type OvsTcpFlag uint16
1275
1276func (self OvsTcpFlag) MarshalJSON() ([]byte, error) {
1277 var flags []string
1278 if self&OvsTCPFlagFin == OvsTCPFlagFin {
1279 flags = append(flags, "\"Fin\": true")
1280 }
1281 if self&OvsTCPFlagSyn == OvsTCPFlagSyn {
1282 flags = append(flags, "\"Syn\": true")
1283 }
1284 if self&OvsTCPFlagRst == OvsTCPFlagRst {
1285 flags = append(flags, "\"Rst\": true")
1286 }
1287 if self&OvsTCPFlagPsh == OvsTCPFlagPsh {
1288 flags = append(flags, "\"Psh\": true")
1289 }
1290 if self&OvsTCPFlagAck == OvsTCPFlagAck {
1291 flags = append(flags, "\"Ack\": true")
1292 }
1293 if self&OvsTCPFlagUrg == OvsTCPFlagUrg {
1294 flags = append(flags, "\"Urg\": true")
1295 }
1296 if self&OvsTCPFlagEce == OvsTCPFlagEce {
1297 flags = append(flags, "\"Ece\": true")
1298 }
1299 if self&OvsTCPFlagCwr == OvsTCPFlagCwr {
1300 flags = append(flags, "\"Cwr\": true")
1301 }
1302 if self&OvsTCPFlagNs == OvsTCPFlagNs {
1303 flags = append(flags, "\"Ns\": true")
1304 }
1305 return []byte("{" + strings.Join(flags, ", ") + "}"), nil
1306}
1307
1308const (
1309 // Identifiers from group ofp_oxm_class
1310 OFPXMCNxm0 = 0 // OFPXMC_NXM_0
1311 OFPXMCNxm1 = 1 // OFPXMC_NXM_1
1312 OFPXMCOpenflowBasic = 32768 // OFPXMC_OPENFLOW_BASIC
1313 OFPXMCExperimenter = 65535 // OFPXMC_EXPERIMENTER
1314)
1315
1316type OxmClass uint16
1317
1318func (self OxmClass) MarshalJSON() ([]byte, error) {
1319 return []byte(fmt.Sprintf("%d", self)), nil
1320}
1321
1322const (
1323 // Identifiers from group ofp_packet_in_reason
1324 OFPRNoMatch = 0 // OFPR_NO_MATCH
1325 OFPRAction = 1 // OFPR_ACTION
1326 OFPRInvalidTtl = 2 // OFPR_INVALID_TTL
1327)
1328
1329type PacketInReason uint8
1330
1331func (self PacketInReason) MarshalJSON() ([]byte, error) {
1332 return []byte(fmt.Sprintf("%d", self)), nil
1333}
1334
1335const (
1336 // Identifiers from group ofp_packet_type
1337 PtEthernet = 0 // OFP_PT_ETHERNET
1338 PtUseNextProto = 65534 // OFP_PT_USE_NEXT_PROTO
1339 PtIpv4 = 67584 // OFP_PT_IPV4
1340 PtMpls = 100423 // OFP_PT_MPLS
1341 PtMplsMc = 100424 // OFP_PT_MPLS_MC
1342 PtNsh = 100687 // OFP_PT_NSH
1343 PtUnknown = 4294967295 // OFP_PT_UNKNOWN
1344)
1345
1346type PacketType uint32
1347
1348func (self PacketType) MarshalJSON() ([]byte, error) {
1349 return []byte(fmt.Sprintf("\"%s\"", self)), nil
1350}
1351
1352func (self PacketType) String() string {
1353 switch self {
1354 case PtEthernet:
1355 return "ethernet"
1356 case PtUseNextProto:
1357 return "use_next_proto"
1358 case PtIpv4:
1359 return "ipv4"
1360 case PtMpls:
1361 return "mpls"
1362 case PtMplsMc:
1363 return "mpls_mc"
1364 case PtNsh:
1365 return "nsh"
1366 case PtUnknown:
1367 return "unknown"
1368 default:
1369 return fmt.Sprintf("%d", self)
1370 }
1371}
1372
1373const (
1374 // Identifiers from group ofp_port
1375 OFPPMax = 4294967040 // OFPP_MAX
1376 OFPPInPort = 4294967288 // OFPP_IN_PORT
1377 OFPPTable = 4294967289 // OFPP_TABLE
1378 OFPPNormal = 4294967290 // OFPP_NORMAL
1379 OFPPFlood = 4294967291 // OFPP_FLOOD
1380 OFPPAll = 4294967292 // OFPP_ALL
1381 OFPPController = 4294967293 // OFPP_CONTROLLER
1382 OFPPLocal = 4294967294 // OFPP_LOCAL
1383 OFPPAny = 4294967295 // OFPP_ANY
1384)
1385
1386type Port uint32
1387
1388func (self Port) MarshalJSON() ([]byte, error) {
1389 return []byte(fmt.Sprintf("%d", self)), nil
1390}
1391
1392const (
1393 // Identifiers from group ofp_port_config
1394 OFPPCPortDown = 1 // OFPPC_PORT_DOWN
1395 OFPPCNoRecv = 4 // OFPPC_NO_RECV
1396 OFPPCNoFwd = 32 // OFPPC_NO_FWD
1397 OFPPCNoPacketIn = 64 // OFPPC_NO_PACKET_IN
1398 OFPPCBSNMirrorDest = 2147483648 // OFPPC_BSN_MIRROR_DEST
1399)
1400
1401type PortConfig uint32
1402
1403func (self PortConfig) MarshalJSON() ([]byte, error) {
1404 var flags []string
1405 if self&OFPPCPortDown == OFPPCPortDown {
1406 flags = append(flags, "\"PortDown\": true")
1407 }
1408 if self&OFPPCNoRecv == OFPPCNoRecv {
1409 flags = append(flags, "\"NoRecv\": true")
1410 }
1411 if self&OFPPCNoFwd == OFPPCNoFwd {
1412 flags = append(flags, "\"NoFwd\": true")
1413 }
1414 if self&OFPPCNoPacketIn == OFPPCNoPacketIn {
1415 flags = append(flags, "\"NoPacketIn\": true")
1416 }
1417 if self&OFPPCBSNMirrorDest == OFPPCBSNMirrorDest {
1418 flags = append(flags, "\"BsnMirrorDest\": true")
1419 }
1420 return []byte("{" + strings.Join(flags, ", ") + "}"), nil
1421}
1422
1423const (
1424 // Identifiers from group ofp_port_features
1425 OFPPF10MbHd = 1 // OFPPF_10MB_HD
1426 OFPPF10MbFd = 2 // OFPPF_10MB_FD
1427 OFPPF100MbHd = 4 // OFPPF_100MB_HD
1428 OFPPF100MbFd = 8 // OFPPF_100MB_FD
1429 OFPPF1GbHd = 16 // OFPPF_1GB_HD
1430 OFPPF1GbFd = 32 // OFPPF_1GB_FD
1431 OFPPF10GbFd = 64 // OFPPF_10GB_FD
1432 OFPPF40GbFd = 128 // OFPPF_40GB_FD
1433 OFPPF100GbFd = 256 // OFPPF_100GB_FD
1434 OFPPF1TbFd = 512 // OFPPF_1TB_FD
1435 OFPPFOther = 1024 // OFPPF_OTHER
1436 OFPPFCopper = 2048 // OFPPF_COPPER
1437 OFPPFFiber = 4096 // OFPPF_FIBER
1438 OFPPFAutoneg = 8192 // OFPPF_AUTONEG
1439 OFPPFPause = 16384 // OFPPF_PAUSE
1440 OFPPFPauseAsym = 32768 // OFPPF_PAUSE_ASYM
1441)
1442
1443type PortFeatures uint32
1444
1445func (self PortFeatures) MarshalJSON() ([]byte, error) {
1446 var flags []string
1447 if self&OFPPF10MbHd == OFPPF10MbHd {
1448 flags = append(flags, "\"10MbHd\": true")
1449 }
1450 if self&OFPPF10MbFd == OFPPF10MbFd {
1451 flags = append(flags, "\"10MbFd\": true")
1452 }
1453 if self&OFPPF100MbHd == OFPPF100MbHd {
1454 flags = append(flags, "\"100MbHd\": true")
1455 }
1456 if self&OFPPF100MbFd == OFPPF100MbFd {
1457 flags = append(flags, "\"100MbFd\": true")
1458 }
1459 if self&OFPPF1GbHd == OFPPF1GbHd {
1460 flags = append(flags, "\"1GbHd\": true")
1461 }
1462 if self&OFPPF1GbFd == OFPPF1GbFd {
1463 flags = append(flags, "\"1GbFd\": true")
1464 }
1465 if self&OFPPF10GbFd == OFPPF10GbFd {
1466 flags = append(flags, "\"10GbFd\": true")
1467 }
1468 if self&OFPPF40GbFd == OFPPF40GbFd {
1469 flags = append(flags, "\"40GbFd\": true")
1470 }
1471 if self&OFPPF100GbFd == OFPPF100GbFd {
1472 flags = append(flags, "\"100GbFd\": true")
1473 }
1474 if self&OFPPF1TbFd == OFPPF1TbFd {
1475 flags = append(flags, "\"1TbFd\": true")
1476 }
1477 if self&OFPPFOther == OFPPFOther {
1478 flags = append(flags, "\"Other\": true")
1479 }
1480 if self&OFPPFCopper == OFPPFCopper {
1481 flags = append(flags, "\"Copper\": true")
1482 }
1483 if self&OFPPFFiber == OFPPFFiber {
1484 flags = append(flags, "\"Fiber\": true")
1485 }
1486 if self&OFPPFAutoneg == OFPPFAutoneg {
1487 flags = append(flags, "\"Autoneg\": true")
1488 }
1489 if self&OFPPFPause == OFPPFPause {
1490 flags = append(flags, "\"Pause\": true")
1491 }
1492 if self&OFPPFPauseAsym == OFPPFPauseAsym {
1493 flags = append(flags, "\"PauseAsym\": true")
1494 }
1495 return []byte("{" + strings.Join(flags, ", ") + "}"), nil
1496}
1497
1498const (
1499 // Identifiers from group ofp_port_mod_failed_code
1500 OFPPMFCBadPort = 0 // OFPPMFC_BAD_PORT
1501 OFPPMFCBadHwAddr = 1 // OFPPMFC_BAD_HW_ADDR
1502 OFPPMFCBadConfig = 2 // OFPPMFC_BAD_CONFIG
1503 OFPPMFCBadAdvertise = 3 // OFPPMFC_BAD_ADVERTISE
1504 OFPPMFCEperm = 4 // OFPPMFC_EPERM
1505)
1506
1507type PortModFailedCode uint16
1508
1509func (self PortModFailedCode) MarshalJSON() ([]byte, error) {
1510 return []byte(fmt.Sprintf("%d", self)), nil
1511}
1512
1513const (
1514 // Identifiers from group ofp_port_reason
1515 OFPPRAdd = 0 // OFPPR_ADD
1516 OFPPRDelete = 1 // OFPPR_DELETE
1517 OFPPRModify = 2 // OFPPR_MODIFY
1518)
1519
1520type PortReason uint8
1521
1522func (self PortReason) MarshalJSON() ([]byte, error) {
1523 return []byte(fmt.Sprintf("%d", self)), nil
1524}
1525
1526const (
1527 // Identifiers from group ofp_port_state
1528 OFPPSLinkDown = 1 // OFPPS_LINK_DOWN
1529 OFPPSBlocked = 2 // OFPPS_BLOCKED
1530 OFPPSLive = 4 // OFPPS_LIVE
1531)
1532
1533type PortState uint32
1534
1535func (self PortState) MarshalJSON() ([]byte, error) {
1536 var flags []string
1537 if self&OFPPSLinkDown == OFPPSLinkDown {
1538 flags = append(flags, "\"LinkDown\": true")
1539 }
1540 if self&OFPPSBlocked == OFPPSBlocked {
1541 flags = append(flags, "\"Blocked\": true")
1542 }
1543 if self&OFPPSLive == OFPPSLive {
1544 flags = append(flags, "\"Live\": true")
1545 }
1546 return []byte("{" + strings.Join(flags, ", ") + "}"), nil
1547}
1548
1549const (
1550 // Identifiers from group ofp_queue_op_failed_code
1551 OFPQOFCBadPort = 0 // OFPQOFC_BAD_PORT
1552 OFPQOFCBadQueue = 1 // OFPQOFC_BAD_QUEUE
1553 OFPQOFCEperm = 2 // OFPQOFC_EPERM
1554)
1555
1556type QueueOpFailedCode uint16
1557
1558func (self QueueOpFailedCode) MarshalJSON() ([]byte, error) {
1559 return []byte(fmt.Sprintf("%d", self)), nil
1560}
1561
1562const (
1563 // Identifiers from group ofp_queue_properties
1564 OFPQTMinRate = 1 // OFPQT_MIN_RATE
1565 OFPQTMaxRate = 2 // OFPQT_MAX_RATE
1566 OFPQTExperimenter = 65535 // OFPQT_EXPERIMENTER
1567)
1568
1569type QueueProperties uint16
1570
1571func (self QueueProperties) MarshalJSON() ([]byte, error) {
1572 return []byte(fmt.Sprintf("%d", self)), nil
1573}
1574
1575const (
1576 // Identifiers from group ofp_role_request_failed_code
1577 OFPRRFCStale = 0 // OFPRRFC_STALE
1578 OFPRRFCUnsup = 1 // OFPRRFC_UNSUP
1579 OFPRRFCBadRole = 2 // OFPRRFC_BAD_ROLE
1580)
1581
1582type RoleRequestFailedCode uint16
1583
1584func (self RoleRequestFailedCode) MarshalJSON() ([]byte, error) {
1585 return []byte(fmt.Sprintf("%d", self)), nil
1586}
1587
1588const (
1589 // Identifiers from group ofp_stats_reply_flags
1590 OFPSFReplyMore = 1 // OFPSF_REPLY_MORE
1591)
1592
1593type StatsReplyFlags uint16
1594
1595func (self StatsReplyFlags) MarshalJSON() ([]byte, error) {
1596 var flags []string
1597 if self&OFPSFReplyMore == OFPSFReplyMore {
1598 flags = append(flags, "\"OFPSFReplyMore\": true")
1599 }
1600 return []byte("{" + strings.Join(flags, ", ") + "}"), nil
1601}
1602
1603const (
1604// Identifiers from group ofp_stats_request_flags
1605)
1606
1607type StatsRequestFlags uint16
1608
1609func (self StatsRequestFlags) MarshalJSON() ([]byte, error) {
1610 var flags []string
1611 return []byte("{" + strings.Join(flags, ", ") + "}"), nil
1612}
1613
1614const (
1615 // Identifiers from group ofp_stats_type
1616 OFPSTDesc = 0 // OFPST_DESC
1617 OFPSTFlow = 1 // OFPST_FLOW
1618 OFPSTAggregate = 2 // OFPST_AGGREGATE
1619 OFPSTTable = 3 // OFPST_TABLE
1620 OFPSTPort = 4 // OFPST_PORT
1621 OFPSTQueue = 5 // OFPST_QUEUE
1622 OFPSTGroup = 6 // OFPST_GROUP
1623 OFPSTGroupDesc = 7 // OFPST_GROUP_DESC
1624 OFPSTGroupFeatures = 8 // OFPST_GROUP_FEATURES
1625 OFPSTExperimenter = 65535 // OFPST_EXPERIMENTER
1626)
1627
1628type StatsType uint16
1629
1630func (self StatsType) MarshalJSON() ([]byte, error) {
1631 return []byte(fmt.Sprintf("%d", self)), nil
1632}
1633
1634const (
1635 // Identifiers from group ofp_switch_config_failed_code
1636 OFPSCFCBadFlags = 0 // OFPSCFC_BAD_FLAGS
1637 OFPSCFCBadLen = 1 // OFPSCFC_BAD_LEN
1638 OFPSCFCEperm = 2 // OFPSCFC_EPERM
1639)
1640
1641type SwitchConfigFailedCode uint16
1642
1643func (self SwitchConfigFailedCode) MarshalJSON() ([]byte, error) {
1644 return []byte(fmt.Sprintf("%d", self)), nil
1645}
1646
1647const (
1648 // Identifiers from group ofp_table
1649 OFPTTMax = 254 // OFPTT_MAX
1650 OFPTTAll = 255 // OFPTT_ALL
1651)
1652
1653type Table uint8
1654
1655func (self Table) MarshalJSON() ([]byte, error) {
1656 return []byte(fmt.Sprintf("%d", self)), nil
1657}
1658
1659const (
1660 // Identifiers from group ofp_table_config
1661 OFPTCTableMissController = 0 // OFPTC_TABLE_MISS_CONTROLLER
1662 OFPTCTableMissContinue = 1 // OFPTC_TABLE_MISS_CONTINUE
1663 OFPTCTableMissDrop = 2 // OFPTC_TABLE_MISS_DROP
1664 OFPTCTableMissMask = 3 // OFPTC_TABLE_MISS_MASK
1665)
1666
1667type TableConfig uint32
1668
1669func (self TableConfig) MarshalJSON() ([]byte, error) {
1670 var flags []string
1671 if self&OFPTCTableMissController == OFPTCTableMissController {
1672 flags = append(flags, "\"Controller\": true")
1673 }
1674 if self&OFPTCTableMissContinue == OFPTCTableMissContinue {
1675 flags = append(flags, "\"Continue\": true")
1676 }
1677 if self&OFPTCTableMissDrop == OFPTCTableMissDrop {
1678 flags = append(flags, "\"Drop\": true")
1679 }
1680 if self&OFPTCTableMissMask == OFPTCTableMissMask {
1681 flags = append(flags, "\"Mask\": true")
1682 }
1683 return []byte("{" + strings.Join(flags, ", ") + "}"), nil
1684}
1685
1686const (
1687 // Identifiers from group ofp_table_mod_failed_code
1688 OFPTMFCBadTable = 0 // OFPTMFC_BAD_TABLE
1689 OFPTMFCBadConfig = 1 // OFPTMFC_BAD_CONFIG
1690 OFPTMFCEperm = 2 // OFPTMFC_EPERM
1691)
1692
1693type TableModFailedCode uint16
1694
1695func (self TableModFailedCode) MarshalJSON() ([]byte, error) {
1696 return []byte(fmt.Sprintf("%d", self)), nil
1697}
1698
1699const (
1700 // Identifiers from group ofp_tcp_flags
1701 TcpFlagCwr = 128 // TCP_FLAG_CWR
1702 TcpFlagEce = 64 // TCP_FLAG_ECE
1703 TcpFlagUrg = 32 // TCP_FLAG_URG
1704 TcpFlagAck = 16 // TCP_FLAG_ACK
1705 TcpFlagPsh = 8 // TCP_FLAG_PSH
1706 TcpFlagRst = 4 // TCP_FLAG_RST
1707 TcpFlagSyn = 2 // TCP_FLAG_SYN
1708 TcpFlagFin = 1 // TCP_FLAG_FIN
1709)
1710
1711type TcpFlags uint16
1712
1713func (self TcpFlags) MarshalJSON() ([]byte, error) {
1714 var flags []string
1715 if self&TcpFlagCwr == TcpFlagCwr {
1716 flags = append(flags, "\"Cwr\": true")
1717 }
1718 if self&TcpFlagEce == TcpFlagEce {
1719 flags = append(flags, "\"Ece\": true")
1720 }
1721 if self&TcpFlagUrg == TcpFlagUrg {
1722 flags = append(flags, "\"Urg\": true")
1723 }
1724 if self&TcpFlagAck == TcpFlagAck {
1725 flags = append(flags, "\"Ack\": true")
1726 }
1727 if self&TcpFlagPsh == TcpFlagPsh {
1728 flags = append(flags, "\"Psh\": true")
1729 }
1730 if self&TcpFlagRst == TcpFlagRst {
1731 flags = append(flags, "\"Rst\": true")
1732 }
1733 if self&TcpFlagSyn == TcpFlagSyn {
1734 flags = append(flags, "\"Syn\": true")
1735 }
1736 if self&TcpFlagFin == TcpFlagFin {
1737 flags = append(flags, "\"Fin\": true")
1738 }
1739 return []byte("{" + strings.Join(flags, ", ") + "}"), nil
1740}
1741
1742const (
1743 // Identifiers from group ofp_type
1744 OFPTHello = 0 // OFPT_HELLO
1745 OFPTError = 1 // OFPT_ERROR
1746 OFPTEchoRequest = 2 // OFPT_ECHO_REQUEST
1747 OFPTEchoReply = 3 // OFPT_ECHO_REPLY
1748 OFPTExperimenter = 4 // OFPT_EXPERIMENTER
1749 OFPTFeaturesRequest = 5 // OFPT_FEATURES_REQUEST
1750 OFPTFeaturesReply = 6 // OFPT_FEATURES_REPLY
1751 OFPTGetConfigRequest = 7 // OFPT_GET_CONFIG_REQUEST
1752 OFPTGetConfigReply = 8 // OFPT_GET_CONFIG_REPLY
1753 OFPTSetConfig = 9 // OFPT_SET_CONFIG
1754 OFPTPacketIn = 10 // OFPT_PACKET_IN
1755 OFPTFlowRemoved = 11 // OFPT_FLOW_REMOVED
1756 OFPTPortStatus = 12 // OFPT_PORT_STATUS
1757 OFPTPacketOut = 13 // OFPT_PACKET_OUT
1758 OFPTFlowMod = 14 // OFPT_FLOW_MOD
1759 OFPTGroupMod = 15 // OFPT_GROUP_MOD
1760 OFPTPortMod = 16 // OFPT_PORT_MOD
1761 OFPTTableMod = 17 // OFPT_TABLE_MOD
1762 OFPTStatsRequest = 18 // OFPT_STATS_REQUEST
1763 OFPTStatsReply = 19 // OFPT_STATS_REPLY
1764 OFPTBarrierRequest = 20 // OFPT_BARRIER_REQUEST
1765 OFPTBarrierReply = 21 // OFPT_BARRIER_REPLY
1766 OFPTQueueGetConfigRequest = 22 // OFPT_QUEUE_GET_CONFIG_REQUEST
1767 OFPTQueueGetConfigReply = 23 // OFPT_QUEUE_GET_CONFIG_REPLY
1768 OFPTRoleRequest = 24 // OFPT_ROLE_REQUEST
1769 OFPTRoleReply = 25 // OFPT_ROLE_REPLY
1770)
1771
1772type Type uint8
1773
1774func (self Type) MarshalJSON() ([]byte, error) {
1775 return []byte(fmt.Sprintf("\"%s\"", self)), nil
1776}
1777
1778func (self Type) String() string {
1779 switch self {
1780 case OFPTHello:
1781 return "hello"
1782 case OFPTError:
1783 return "error"
1784 case OFPTEchoRequest:
1785 return "echo_request"
1786 case OFPTEchoReply:
1787 return "echo_reply"
1788 case OFPTExperimenter:
1789 return "experimenter"
1790 case OFPTFeaturesRequest:
1791 return "features_request"
1792 case OFPTFeaturesReply:
1793 return "features_reply"
1794 case OFPTGetConfigRequest:
1795 return "get_config_request"
1796 case OFPTGetConfigReply:
1797 return "get_config_reply"
1798 case OFPTSetConfig:
1799 return "set_config"
1800 case OFPTPacketIn:
1801 return "packet_in"
1802 case OFPTFlowRemoved:
1803 return "flow_removed"
1804 case OFPTPortStatus:
1805 return "port_status"
1806 case OFPTPacketOut:
1807 return "packet_out"
1808 case OFPTFlowMod:
1809 return "flow_mod"
1810 case OFPTGroupMod:
1811 return "group_mod"
1812 case OFPTPortMod:
1813 return "port_mod"
1814 case OFPTTableMod:
1815 return "table_mod"
1816 case OFPTStatsRequest:
1817 return "stats_request"
1818 case OFPTStatsReply:
1819 return "stats_reply"
1820 case OFPTBarrierRequest:
1821 return "barrier_request"
1822 case OFPTBarrierReply:
1823 return "barrier_reply"
1824 case OFPTQueueGetConfigRequest:
1825 return "queue_get_config_request"
1826 case OFPTQueueGetConfigReply:
1827 return "queue_get_config_reply"
1828 case OFPTRoleRequest:
1829 return "role_request"
1830 case OFPTRoleReply:
1831 return "role_reply"
1832 default:
1833 return fmt.Sprintf("%d", self)
1834 }
1835}
1836
1837const (
1838 // Identifiers from group ofp_vlan_id
1839 OFPVIDNone = 0 // OFPVID_NONE
1840 OFPVIDPresent = 4096 // OFPVID_PRESENT
1841)
1842
1843type VlanId uint16
1844
1845func (self VlanId) MarshalJSON() ([]byte, error) {
1846 return []byte(fmt.Sprintf("%d", self)), nil
1847}