blob: 3d384e4d02f55ed18ad398042645d7525e7f594c [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 of10
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 = 65535 // OFP_VLAN_NONE
26 OFPFWICMPType = 64 // OFPFW_ICMP_TYPE
27 OFPFWICMPCode = 128 // OFPFW_ICMP_CODE
28 DlTypeEth2Cutoff = 1536 // OFP_DL_TYPE_ETH2_CUTOFF
29 DlTypeNotEthType = 1535 // OFP_DL_TYPE_NOT_ETH_TYPE
30 FlowPermanent = 0 // OFP_FLOW_PERMANENT
31 DefaultPriority = 32768 // OFP_DEFAULT_PRIORITY
32 DescStrLen = 256 // DESC_STR_LEN
33 SerialNumLen = 32 // SERIAL_NUM_LEN
34 OFPQAll = 4294967295 // OFPQ_ALL
35 OFPQMinRateUncfg = 65535 // OFPQ_MIN_RATE_UNCFG
36)
37
38const (
39 // Identifiers from group nx_action_controller2_prop_type
40 Nxac2PtMaxLen = 0 // NXAC2PT_MAX_LEN
41 Nxac2PtControllerID = 1 // NXAC2PT_CONTROLLER_ID
42 Nxac2PtReason = 2 // NXAC2PT_REASON
43 Nxac2PtUserdata = 3 // NXAC2PT_USERDATA
44 Nxac2PtPause = 4 // NXAC2PT_PAUSE
45 Nxac2PtMeterID = 5 // NXAC2PT_METER_ID
46)
47
48type NxActionController2PropType uint16
49
50func (self NxActionController2PropType) MarshalJSON() ([]byte, error) {
51 return []byte(fmt.Sprintf("%d", self)), nil
52}
53
54const (
55 // Identifiers from group nx_bd_algorithms
56 NxBdAlgActiveBackup = 0 // NX_BD_ALG_ACTIVE_BACKUP
57 NxBdAlgHrw = 1 // NX_BD_ALG_HRW
58)
59
60type NxBdAlgorithms uint16
61
62func (self NxBdAlgorithms) MarshalJSON() ([]byte, error) {
63 return []byte(fmt.Sprintf("\"%s\"", self)), nil
64}
65
66func (self NxBdAlgorithms) String() string {
67 switch self {
68 case NxBdAlgActiveBackup:
69 return "active_backup"
70 case NxBdAlgHrw:
71 return "hrw"
72 default:
73 return fmt.Sprintf("%d", self)
74 }
75}
76
77const (
78 // Identifiers from group nx_conntrack_flags
79 NxCtFCommit = 1 // NX_CT_F_COMMIT
80 NxCtFForce = 2 // NX_CT_F_FORCE
81)
82
83type NxConntrackFlags uint16
84
85func (self NxConntrackFlags) MarshalJSON() ([]byte, error) {
86 var flags []string
87 if self&NxCtFCommit == NxCtFCommit {
88 flags = append(flags, "\"Commit\": true")
89 }
90 if self&NxCtFForce == NxCtFForce {
91 flags = append(flags, "\"Force\": true")
92 }
93 return []byte("{" + strings.Join(flags, ", ") + "}"), nil
94}
95
96const (
97 // Identifiers from group nx_flow_monitor_flags
98 NxfmfInitial = 1 // NXFMF_INITIAL
99 NxfmfAdd = 2 // NXFMF_ADD
100 NxfmfDelete = 4 // NXFMF_DELETE
101 NxfmfModify = 8 // NXFMF_MODIFY
102 NxfmfActions = 16 // NXFMF_ACTIONS
103 NxfmfOwn = 32 // NXFMF_OWN
104)
105
106type NxFlowMonitorFlags uint16
107
108func (self NxFlowMonitorFlags) MarshalJSON() ([]byte, error) {
109 var flags []string
110 if self&NxfmfInitial == NxfmfInitial {
111 flags = append(flags, "\"Initial\": true")
112 }
113 if self&NxfmfAdd == NxfmfAdd {
114 flags = append(flags, "\"Add\": true")
115 }
116 if self&NxfmfDelete == NxfmfDelete {
117 flags = append(flags, "\"Delete\": true")
118 }
119 if self&NxfmfModify == NxfmfModify {
120 flags = append(flags, "\"Modify\": true")
121 }
122 if self&NxfmfActions == NxfmfActions {
123 flags = append(flags, "\"Actions\": true")
124 }
125 if self&NxfmfOwn == NxfmfOwn {
126 flags = append(flags, "\"Own\": true")
127 }
128 return []byte("{" + strings.Join(flags, ", ") + "}"), nil
129}
130
131const (
132 // Identifiers from group nx_hash_fields
133 NxHashFieldsEthSrc = 0 // NX_HASH_FIELDS_ETH_SRC
134 NxHashFieldsSymmetricL4 = 1 // NX_HASH_FIELDS_SYMMETRIC_L4
135 NxHashFieldsSymmetricL3L4 = 2 // NX_HASH_FIELDS_SYMMETRIC_L3L4
136 NxHashFieldsSymmetricL3L4Udp = 3 // NX_HASH_FIELDS_SYMMETRIC_L3L4_UDP
137 NxHashFieldsNwSrc = 4 // NX_HASH_FIELDS_NW_SRC
138 NxHashFieldsNwDst = 5 // NX_HASH_FIELDS_NW_DST
139 NxHashFieldsSymmetricL3 = 6 // NX_HASH_FIELDS_SYMMETRIC_L3
140)
141
142type NxHashFields uint16
143
144func (self NxHashFields) MarshalJSON() ([]byte, error) {
145 return []byte(fmt.Sprintf("\"%s\"", self)), nil
146}
147
148func (self NxHashFields) String() string {
149 switch self {
150 case NxHashFieldsEthSrc:
151 return "eth_src"
152 case NxHashFieldsSymmetricL4:
153 return "symmetric_l4"
154 case NxHashFieldsSymmetricL3L4:
155 return "symmetric_l3l4"
156 case NxHashFieldsSymmetricL3L4Udp:
157 return "symmetric_l3l4_udp"
158 case NxHashFieldsNwSrc:
159 return "nw_src"
160 case NxHashFieldsNwDst:
161 return "nw_dst"
162 case NxHashFieldsSymmetricL3:
163 return "symmetric_l3"
164 default:
165 return fmt.Sprintf("%d", self)
166 }
167}
168
169const (
170 // Identifiers from group nx_mp_algorithm
171 NxMpAlgModuloN = 0 // NX_MP_ALG_MODULO_N
172 NxMpAlgHashThreshold = 1 // NX_MP_ALG_HASH_THRESHOLD
173 NxMpAlgHrw = 2 // NX_MP_ALG_HRW
174 NxMpAlgIterHash = 3 // NX_MP_ALG_ITER_HASH
175)
176
177type NxMpAlgorithm uint16
178
179func (self NxMpAlgorithm) MarshalJSON() ([]byte, error) {
180 return []byte(fmt.Sprintf("\"%s\"", self)), nil
181}
182
183func (self NxMpAlgorithm) String() string {
184 switch self {
185 case NxMpAlgModuloN:
186 return "modulo_n"
187 case NxMpAlgHashThreshold:
188 return "hash_threshold"
189 case NxMpAlgHrw:
190 return "hrw"
191 case NxMpAlgIterHash:
192 return "iter_hash"
193 default:
194 return fmt.Sprintf("%d", self)
195 }
196}
197
198const (
199 // Identifiers from group of_action_nx_bundle_slave_type
200 NxmOfInPort = 2 // NXM_OF_IN_PORT
201 NxmOfJustThereToDefinePrefix = 10000 // NXM_OF_JUST_THERE_TO_DEFINE_PREFIX
202)
203
204type ActionNxBundleSlaveType uint32
205
206func (self ActionNxBundleSlaveType) MarshalJSON() ([]byte, error) {
207 return []byte(fmt.Sprintf("\"%s\"", self)), nil
208}
209
210func (self ActionNxBundleSlaveType) String() string {
211 switch self {
212 case NxmOfInPort:
213 return "in_port"
214 case NxmOfJustThereToDefinePrefix:
215 return "just_there_to_define_prefix"
216 default:
217 return fmt.Sprintf("%d", self)
218 }
219}
220
221const (
222 // Identifiers from group of_bsn_pdu_slot_num
223 BsnPduSlotNumAny = 255 // BSN_PDU_SLOT_NUM_ANY
224)
225
226type BsnPduSlotNum uint8
227
228func (self BsnPduSlotNum) MarshalJSON() ([]byte, error) {
229 return []byte(fmt.Sprintf("%d", self)), nil
230}
231
232const (
233 // Identifiers from group of_nx_nat_range
234 NxNatRangeIpv4Min = 1 // NX_NAT_RANGE_IPV4_MIN
235 NxNatRangeIpv4Max = 2 // NX_NAT_RANGE_IPV4_MAX
236 NxNatRangeIpv6Min = 4 // NX_NAT_RANGE_IPV6_MIN
237 NxNatRangeIpv6Max = 8 // NX_NAT_RANGE_IPV6_MAX
238 NxNatRangeProtoMin = 16 // NX_NAT_RANGE_PROTO_MIN
239 NxNatRangeProtoMax = 32 // NX_NAT_RANGE_PROTO_MAX
240)
241
242type NxNatRange uint16
243
244func (self NxNatRange) MarshalJSON() ([]byte, error) {
245 var flags []string
246 if self&NxNatRangeIpv4Min == NxNatRangeIpv4Min {
247 flags = append(flags, "\"Ipv4Min\": true")
248 }
249 if self&NxNatRangeIpv4Max == NxNatRangeIpv4Max {
250 flags = append(flags, "\"Ipv4Max\": true")
251 }
252 if self&NxNatRangeIpv6Min == NxNatRangeIpv6Min {
253 flags = append(flags, "\"Ipv6Min\": true")
254 }
255 if self&NxNatRangeIpv6Max == NxNatRangeIpv6Max {
256 flags = append(flags, "\"Ipv6Max\": true")
257 }
258 if self&NxNatRangeProtoMin == NxNatRangeProtoMin {
259 flags = append(flags, "\"ProtoMin\": true")
260 }
261 if self&NxNatRangeProtoMax == NxNatRangeProtoMax {
262 flags = append(flags, "\"ProtoMax\": true")
263 }
264 return []byte("{" + strings.Join(flags, ", ") + "}"), nil
265}
266
267const (
268 // Identifiers from group ofp_action_type
269 OFPATOutput = 0 // OFPAT_OUTPUT
270 OFPATSetVLANVid = 1 // OFPAT_SET_VLAN_VID
271 OFPATSetVLANPCP = 2 // OFPAT_SET_VLAN_PCP
272 OFPATStripVLAN = 3 // OFPAT_STRIP_VLAN
273 OFPATSetDlSrc = 4 // OFPAT_SET_DL_SRC
274 OFPATSetDlDst = 5 // OFPAT_SET_DL_DST
275 OFPATSetNwSrc = 6 // OFPAT_SET_NW_SRC
276 OFPATSetNwDst = 7 // OFPAT_SET_NW_DST
277 OFPATSetNwTos = 8 // OFPAT_SET_NW_TOS
278 OFPATSetTpSrc = 9 // OFPAT_SET_TP_SRC
279 OFPATSetTpDst = 10 // OFPAT_SET_TP_DST
280 OFPATEnqueue = 11 // OFPAT_ENQUEUE
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)
302
303type BadActionCode uint16
304
305func (self BadActionCode) MarshalJSON() ([]byte, error) {
306 return []byte(fmt.Sprintf("%d", self)), nil
307}
308
309const (
310 // Identifiers from group ofp_bad_request_code
311 OFPBRCBadVersion = 0 // OFPBRC_BAD_VERSION
312 OFPBRCBadType = 1 // OFPBRC_BAD_TYPE
313 OFPBRCBadStat = 2 // OFPBRC_BAD_STAT
314 OFPBRCBadExperimenter = 3 // OFPBRC_BAD_EXPERIMENTER
315 OFPBRCBadSubtype = 4 // OFPBRC_BAD_SUBTYPE
316 OFPBRCEperm = 5 // OFPBRC_EPERM
317 OFPBRCBadLen = 6 // OFPBRC_BAD_LEN
318 OFPBRCBufferEmpty = 7 // OFPBRC_BUFFER_EMPTY
319 OFPBRCBufferUnknown = 8 // OFPBRC_BUFFER_UNKNOWN
320)
321
322type BadRequestCode uint16
323
324func (self BadRequestCode) MarshalJSON() ([]byte, error) {
325 return []byte(fmt.Sprintf("%d", self)), nil
326}
327
328const (
329 // Identifiers from group ofp_bsn_vport_l2gre_flags
330 OFBSNVportL2GreLocalMACIsValid = 1 // OF_BSN_VPORT_L2GRE_LOCAL_MAC_IS_VALID
331 OFBSNVportL2GreDSCPAssign = 2 // OF_BSN_VPORT_L2GRE_DSCP_ASSIGN
332 OFBSNVportL2GreDSCPCopy = 4 // OF_BSN_VPORT_L2GRE_DSCP_COPY
333 OFBSNVportL2GreLoopbackIsValid = 8 // OF_BSN_VPORT_L2GRE_LOOPBACK_IS_VALID
334 OFBSNVportL2GreRateLimitIsValid = 16 // OF_BSN_VPORT_L2GRE_RATE_LIMIT_IS_VALID
335)
336
337type BsnVportL2GreFlags uint32
338
339func (self BsnVportL2GreFlags) MarshalJSON() ([]byte, error) {
340 var flags []string
341 if self&OFBSNVportL2GreLocalMACIsValid == OFBSNVportL2GreLocalMACIsValid {
342 flags = append(flags, "\"LocalMACIsValid\": true")
343 }
344 if self&OFBSNVportL2GreDSCPAssign == OFBSNVportL2GreDSCPAssign {
345 flags = append(flags, "\"DscpAssign\": true")
346 }
347 if self&OFBSNVportL2GreDSCPCopy == OFBSNVportL2GreDSCPCopy {
348 flags = append(flags, "\"DscpCopy\": true")
349 }
350 if self&OFBSNVportL2GreLoopbackIsValid == OFBSNVportL2GreLoopbackIsValid {
351 flags = append(flags, "\"LoopbackIsValid\": true")
352 }
353 if self&OFBSNVportL2GreRateLimitIsValid == OFBSNVportL2GreRateLimitIsValid {
354 flags = append(flags, "\"RateLimitIsValid\": true")
355 }
356 return []byte("{" + strings.Join(flags, ", ") + "}"), nil
357}
358
359const (
360 // Identifiers from group ofp_bsn_vport_q_in_q_untagged
361 OFBSNVportQInQUntagged = 65535 // OF_BSN_VPORT_Q_IN_Q_UNTAGGED
362)
363
364type BsnVportQInQUntagged uint16
365
366func (self BsnVportQInQUntagged) MarshalJSON() ([]byte, error) {
367 return []byte(fmt.Sprintf("%d", self)), nil
368}
369
370const (
371 // Identifiers from group ofp_bsn_vport_status
372 OFBSNVportStatusOk = 0 // OF_BSN_VPORT_STATUS_OK
373 OFBSNVportStatusFailed = 1 // OF_BSN_VPORT_STATUS_FAILED
374)
375
376const (
377 // Identifiers from group ofp_capabilities
378 OFPCFlowStats = 1 // OFPC_FLOW_STATS
379 OFPCTableStats = 2 // OFPC_TABLE_STATS
380 OFPCPortStats = 4 // OFPC_PORT_STATS
381 OFPCSTP = 8 // OFPC_STP
382 OFPCReserved = 16 // OFPC_RESERVED
383 OFPCIpReasm = 32 // OFPC_IP_REASM
384 OFPCQueueStats = 64 // OFPC_QUEUE_STATS
385 OFPCARPMatchIp = 128 // OFPC_ARP_MATCH_IP
386)
387
388type Capabilities uint32
389
390func (self Capabilities) MarshalJSON() ([]byte, error) {
391 var flags []string
392 if self&OFPCFlowStats == OFPCFlowStats {
393 flags = append(flags, "\"FlowStats\": true")
394 }
395 if self&OFPCTableStats == OFPCTableStats {
396 flags = append(flags, "\"TableStats\": true")
397 }
398 if self&OFPCPortStats == OFPCPortStats {
399 flags = append(flags, "\"PortStats\": true")
400 }
401 if self&OFPCSTP == OFPCSTP {
402 flags = append(flags, "\"Stp\": true")
403 }
404 if self&OFPCReserved == OFPCReserved {
405 flags = append(flags, "\"Reserved\": true")
406 }
407 if self&OFPCIpReasm == OFPCIpReasm {
408 flags = append(flags, "\"IpReasm\": true")
409 }
410 if self&OFPCQueueStats == OFPCQueueStats {
411 flags = append(flags, "\"QueueStats\": true")
412 }
413 if self&OFPCARPMatchIp == OFPCARPMatchIp {
414 flags = append(flags, "\"ArpMatchIp\": true")
415 }
416 return []byte("{" + strings.Join(flags, ", ") + "}"), nil
417}
418
419const (
420 // Identifiers from group ofp_config_flags
421 OFPCFragNormal = 0 // OFPC_FRAG_NORMAL
422 OFPCFragDrop = 1 // OFPC_FRAG_DROP
423 OFPCFragReasm = 2 // OFPC_FRAG_REASM
424 OFPCFragMask = 3 // OFPC_FRAG_MASK
425)
426
427type ConfigFlags uint16
428
429func (self ConfigFlags) MarshalJSON() ([]byte, error) {
430 var flags []string
431 if self&OFPCFragNormal == OFPCFragNormal {
432 flags = append(flags, "\"Normal\": true")
433 }
434 if self&OFPCFragDrop == OFPCFragDrop {
435 flags = append(flags, "\"Drop\": true")
436 }
437 if self&OFPCFragReasm == OFPCFragReasm {
438 flags = append(flags, "\"Reasm\": true")
439 }
440 if self&OFPCFragMask == OFPCFragMask {
441 flags = append(flags, "\"Mask\": true")
442 }
443 return []byte("{" + strings.Join(flags, ", ") + "}"), nil
444}
445
446const (
447 // Identifiers from group ofp_cs_states
448 CsNew = 1 // OFP_CS_NEW
449 CsEstablished = 2 // OFP_CS_ESTABLISHED
450 CsRelated = 4 // OFP_CS_RELATED
451 CsReplyDir = 8 // OFP_CS_REPLY_DIR
452 CsInvalid = 16 // OFP_CS_INVALID
453 CsTracked = 32 // OFP_CS_TRACKED
454 CsSrcNat = 64 // OFP_CS_SRC_NAT
455 CsDstNat = 128 // OFP_CS_DST_NAT
456)
457
458type CsStates uint32
459
460func (self CsStates) MarshalJSON() ([]byte, error) {
461 var flags []string
462 if self&CsNew == CsNew {
463 flags = append(flags, "\"New\": true")
464 }
465 if self&CsEstablished == CsEstablished {
466 flags = append(flags, "\"Established\": true")
467 }
468 if self&CsRelated == CsRelated {
469 flags = append(flags, "\"Related\": true")
470 }
471 if self&CsReplyDir == CsReplyDir {
472 flags = append(flags, "\"ReplyDir\": true")
473 }
474 if self&CsInvalid == CsInvalid {
475 flags = append(flags, "\"Invalid\": true")
476 }
477 if self&CsTracked == CsTracked {
478 flags = append(flags, "\"Tracked\": true")
479 }
480 if self&CsSrcNat == CsSrcNat {
481 flags = append(flags, "\"SrcNat\": true")
482 }
483 if self&CsDstNat == CsDstNat {
484 flags = append(flags, "\"DstNat\": true")
485 }
486 return []byte("{" + strings.Join(flags, ", ") + "}"), nil
487}
488
489const (
490 // Identifiers from group ofp_ed_nsh_prop_type
491 OFPPPTPropNshNone = 0 // OFPPPT_PROP_NSH_NONE
492 OFPPPTPropNshMdtype = 1 // OFPPPT_PROP_NSH_MDTYPE
493 OFPPPTPropNshTlv = 2 // OFPPPT_PROP_NSH_TLV
494)
495
496type EdNshPropType uint8
497
498func (self EdNshPropType) MarshalJSON() ([]byte, error) {
499 return []byte(fmt.Sprintf("%d", self)), nil
500}
501
502const (
503 // Identifiers from group ofp_ed_prop_class
504 OFPPPCBasic = 0 // OFPPPC_BASIC
505 OFPPPCMpls = 1 // OFPPPC_MPLS
506 OFPPPCGRE = 2 // OFPPPC_GRE
507 OFPPPCGtp = 3 // OFPPPC_GTP
508 OFPPPCNsh = 4 // OFPPPC_NSH
509 OFPPPCExperimenter = 65535 // OFPPPC_EXPERIMENTER
510)
511
512type EdPropClass uint16
513
514func (self EdPropClass) MarshalJSON() ([]byte, error) {
515 return []byte(fmt.Sprintf("%d", self)), nil
516}
517
518const (
519 // Identifiers from group ofp_error_type
520 OFPETHelloFailed = 0 // OFPET_HELLO_FAILED
521 OFPETBadRequest = 1 // OFPET_BAD_REQUEST
522 OFPETBadAction = 2 // OFPET_BAD_ACTION
523 OFPETFlowModFailed = 3 // OFPET_FLOW_MOD_FAILED
524 OFPETPortModFailed = 4 // OFPET_PORT_MOD_FAILED
525 OFPETQueueOpFailed = 5 // OFPET_QUEUE_OP_FAILED
526)
527
528type ErrorType uint16
529
530func (self ErrorType) MarshalJSON() ([]byte, error) {
531 return []byte(fmt.Sprintf("%d", self)), nil
532}
533
534const (
535 // Identifiers from group ofp_ethernet_type
536 EthPLoop = 96 // ETH_P_LOOP
537 EthPPup = 512 // ETH_P_PUP
538 EthPPupat = 513 // ETH_P_PUPAT
539 EthPIp = 2048 // ETH_P_IP
540 EthPX25 = 2053 // ETH_P_X25
541 EthPARP = 2054 // ETH_P_ARP
542 EthPBpq = 2303 // ETH_P_BPQ
543 EthPIeeepup = 2560 // ETH_P_IEEEPUP
544 EthPIeeepupat = 2561 // ETH_P_IEEEPUPAT
545 EthPDec = 24576 // ETH_P_DEC
546 EthPDnaDl = 24577 // ETH_P_DNA_DL
547 EthPDnaRc = 24578 // ETH_P_DNA_RC
548 EthPDnaRt = 24579 // ETH_P_DNA_RT
549 EthPLat = 24580 // ETH_P_LAT
550 EthPDiag = 24581 // ETH_P_DIAG
551 EthPCust = 24582 // ETH_P_CUST
552 EthPSca = 24583 // ETH_P_SCA
553 EthPTeb = 25944 // ETH_P_TEB
554 EthPRarp = 32821 // ETH_P_RARP
555 EthPAtalk = 32923 // ETH_P_ATALK
556 EthPAarp = 33011 // ETH_P_AARP
557 EthP8021Q = 33024 // ETH_P_8021Q
558 EthPIpx = 33079 // ETH_P_IPX
559 EthPIpv6 = 34525 // ETH_P_IPV6
560 EthPPause = 34824 // ETH_P_PAUSE
561 EthPSlow = 34825 // ETH_P_SLOW
562 EthPWccp = 34878 // ETH_P_WCCP
563 EthPPppDisc = 34915 // ETH_P_PPP_DISC
564 EthPPppSes = 34916 // ETH_P_PPP_SES
565 EthPMplsUc = 34887 // ETH_P_MPLS_UC
566 EthPMplsMc = 34888 // ETH_P_MPLS_MC
567 EthPAtmmpoa = 34892 // ETH_P_ATMMPOA
568 EthPAtmfate = 34948 // ETH_P_ATMFATE
569 EthPPae = 34958 // ETH_P_PAE
570 EthPAoe = 34978 // ETH_P_AOE
571 EthPTipc = 35018 // ETH_P_TIPC
572 EthP1588 = 35063 // ETH_P_1588
573 EthPFcoe = 35078 // ETH_P_FCOE
574 EthPFip = 35092 // ETH_P_FIP
575 EthPEdsa = 56026 // ETH_P_EDSA
576)
577
578type EthernetType uint16
579
580func (self EthernetType) MarshalJSON() ([]byte, error) {
581 return []byte(fmt.Sprintf("\"%s\"", self)), nil
582}
583
584func (self EthernetType) String() string {
585 switch self {
586 case EthPLoop:
587 return "loop"
588 case EthPPup:
589 return "pup"
590 case EthPPupat:
591 return "pupat"
592 case EthPIp:
593 return "ip"
594 case EthPX25:
595 return "x25"
596 case EthPARP:
597 return "arp"
598 case EthPBpq:
599 return "bpq"
600 case EthPIeeepup:
601 return "ieeepup"
602 case EthPIeeepupat:
603 return "ieeepupat"
604 case EthPDec:
605 return "dec"
606 case EthPDnaDl:
607 return "dna_dl"
608 case EthPDnaRc:
609 return "dna_rc"
610 case EthPDnaRt:
611 return "dna_rt"
612 case EthPLat:
613 return "lat"
614 case EthPDiag:
615 return "diag"
616 case EthPCust:
617 return "cust"
618 case EthPSca:
619 return "sca"
620 case EthPTeb:
621 return "teb"
622 case EthPRarp:
623 return "rarp"
624 case EthPAtalk:
625 return "atalk"
626 case EthPAarp:
627 return "aarp"
628 case EthP8021Q:
629 return "8021q"
630 case EthPIpx:
631 return "ipx"
632 case EthPIpv6:
633 return "ipv6"
634 case EthPPause:
635 return "pause"
636 case EthPSlow:
637 return "slow"
638 case EthPWccp:
639 return "wccp"
640 case EthPPppDisc:
641 return "ppp_disc"
642 case EthPPppSes:
643 return "ppp_ses"
644 case EthPMplsUc:
645 return "mpls_uc"
646 case EthPMplsMc:
647 return "mpls_mc"
648 case EthPAtmmpoa:
649 return "atmmpoa"
650 case EthPAtmfate:
651 return "atmfate"
652 case EthPPae:
653 return "pae"
654 case EthPAoe:
655 return "aoe"
656 case EthPTipc:
657 return "tipc"
658 case EthP1588:
659 return "1588"
660 case EthPFcoe:
661 return "fcoe"
662 case EthPFip:
663 return "fip"
664 case EthPEdsa:
665 return "edsa"
666 default:
667 return fmt.Sprintf("%d", self)
668 }
669}
670
671const (
672 // Identifiers from group ofp_flow_mod_command
673 OFPFCAdd = 0 // OFPFC_ADD
674 OFPFCModify = 1 // OFPFC_MODIFY
675 OFPFCModifyStrict = 2 // OFPFC_MODIFY_STRICT
676 OFPFCDelete = 3 // OFPFC_DELETE
677 OFPFCDeleteStrict = 4 // OFPFC_DELETE_STRICT
678)
679
680type FlowModCommand uint16
681
682func (self FlowModCommand) MarshalJSON() ([]byte, error) {
683 return []byte(fmt.Sprintf("%d", self)), nil
684}
685
686const (
687 // Identifiers from group ofp_flow_mod_failed_code
688 OFPFMFCAllTablesFull = 0 // OFPFMFC_ALL_TABLES_FULL
689 OFPFMFCOverlap = 1 // OFPFMFC_OVERLAP
690 OFPFMFCEperm = 2 // OFPFMFC_EPERM
691 OFPFMFCBadEmergTimeout = 3 // OFPFMFC_BAD_EMERG_TIMEOUT
692 OFPFMFCBadCommand = 4 // OFPFMFC_BAD_COMMAND
693 OFPFMFCUnsupported = 5 // OFPFMFC_UNSUPPORTED
694)
695
696type FlowModFailedCode uint16
697
698func (self FlowModFailedCode) MarshalJSON() ([]byte, error) {
699 return []byte(fmt.Sprintf("%d", self)), nil
700}
701
702const (
703 // Identifiers from group ofp_flow_mod_flags
704 OFPFFSendFlowRem = 1 // OFPFF_SEND_FLOW_REM
705 OFPFFCheckOverlap = 2 // OFPFF_CHECK_OVERLAP
706 OFPFFEmerg = 4 // OFPFF_EMERG
707)
708
709type FlowModFlags uint16
710
711func (self FlowModFlags) MarshalJSON() ([]byte, error) {
712 var flags []string
713 if self&OFPFFSendFlowRem == OFPFFSendFlowRem {
714 flags = append(flags, "\"SendFlowRem\": true")
715 }
716 if self&OFPFFCheckOverlap == OFPFFCheckOverlap {
717 flags = append(flags, "\"CheckOverlap\": true")
718 }
719 if self&OFPFFEmerg == OFPFFEmerg {
720 flags = append(flags, "\"Emerg\": true")
721 }
722 return []byte("{" + strings.Join(flags, ", ") + "}"), nil
723}
724
725const (
726 // Identifiers from group ofp_flow_removed_reason
727 OFPRRIdleTimeout = 0 // OFPRR_IDLE_TIMEOUT
728 OFPRRHardTimeout = 1 // OFPRR_HARD_TIMEOUT
729 OFPRRDelete = 2 // OFPRR_DELETE
730)
731
732type FlowRemovedReason uint8
733
734func (self FlowRemovedReason) MarshalJSON() ([]byte, error) {
735 return []byte(fmt.Sprintf("%d", self)), nil
736}
737
738const (
739 // Identifiers from group ofp_flow_wildcards
740 OFPFWInPort = 1 // OFPFW_IN_PORT
741 OFPFWDlVLAN = 2 // OFPFW_DL_VLAN
742 OFPFWDlSrc = 4 // OFPFW_DL_SRC
743 OFPFWNwDstBits = 6 // OFPFW_NW_DST_BITS
744 OFPFWNwSrcBits = 6 // OFPFW_NW_SRC_BITS
745 OFPFWNwSrcShift = 8 // OFPFW_NW_SRC_SHIFT
746 OFPFWDlDst = 8 // OFPFW_DL_DST
747 OFPFWNwDstShift = 14 // OFPFW_NW_DST_SHIFT
748 OFPFWDlType = 16 // OFPFW_DL_TYPE
749 OFPFWNwProto = 32 // OFPFW_NW_PROTO
750 OFPFWTpSrc = 64 // OFPFW_TP_SRC
751 OFPFWTpDst = 128 // OFPFW_TP_DST
752 OFPFWNwSrcAll = 8192 // OFPFW_NW_SRC_ALL
753 OFPFWNwSrcMask = 16128 // OFPFW_NW_SRC_MASK
754 OFPFWNwDstAll = 524288 // OFPFW_NW_DST_ALL
755 OFPFWNwDstMask = 1032192 // OFPFW_NW_DST_MASK
756 OFPFWDlVLANPCP = 1048576 // OFPFW_DL_VLAN_PCP
757 OFPFWNwTos = 2097152 // OFPFW_NW_TOS
758 OFPFWAll = 4194303 // OFPFW_ALL
759)
760
761type FlowWildcards uint32
762
763func (self FlowWildcards) MarshalJSON() ([]byte, error) {
764 var flags []string
765 if self&OFPFWInPort == OFPFWInPort {
766 flags = append(flags, "\"InPort\": true")
767 }
768 if self&OFPFWDlVLAN == OFPFWDlVLAN {
769 flags = append(flags, "\"DlVLAN\": true")
770 }
771 if self&OFPFWDlSrc == OFPFWDlSrc {
772 flags = append(flags, "\"DlSrc\": true")
773 }
774 if self&OFPFWNwDstBits == OFPFWNwDstBits {
775 flags = append(flags, "\"NwDstBits\": true")
776 }
777 if self&OFPFWNwSrcBits == OFPFWNwSrcBits {
778 flags = append(flags, "\"NwSrcBits\": true")
779 }
780 if self&OFPFWNwSrcShift == OFPFWNwSrcShift {
781 flags = append(flags, "\"NwSrcShift\": true")
782 }
783 if self&OFPFWDlDst == OFPFWDlDst {
784 flags = append(flags, "\"DlDst\": true")
785 }
786 if self&OFPFWNwDstShift == OFPFWNwDstShift {
787 flags = append(flags, "\"NwDstShift\": true")
788 }
789 if self&OFPFWDlType == OFPFWDlType {
790 flags = append(flags, "\"DlType\": true")
791 }
792 if self&OFPFWNwProto == OFPFWNwProto {
793 flags = append(flags, "\"NwProto\": true")
794 }
795 if self&OFPFWTpSrc == OFPFWTpSrc {
796 flags = append(flags, "\"TpSrc\": true")
797 }
798 if self&OFPFWTpDst == OFPFWTpDst {
799 flags = append(flags, "\"TpDst\": true")
800 }
801 if self&OFPFWNwSrcAll == OFPFWNwSrcAll {
802 flags = append(flags, "\"NwSrcAll\": true")
803 }
804 if self&OFPFWNwSrcMask == OFPFWNwSrcMask {
805 flags = append(flags, "\"NwSrcMask\": true")
806 }
807 if self&OFPFWNwDstAll == OFPFWNwDstAll {
808 flags = append(flags, "\"NwDstAll\": true")
809 }
810 if self&OFPFWNwDstMask == OFPFWNwDstMask {
811 flags = append(flags, "\"NwDstMask\": true")
812 }
813 if self&OFPFWDlVLANPCP == OFPFWDlVLANPCP {
814 flags = append(flags, "\"DlVLANPCP\": true")
815 }
816 if self&OFPFWNwTos == OFPFWNwTos {
817 flags = append(flags, "\"NwTos\": true")
818 }
819 if self&OFPFWAll == OFPFWAll {
820 flags = append(flags, "\"All\": true")
821 }
822 return []byte("{" + strings.Join(flags, ", ") + "}"), nil
823}
824
825const (
826 // Identifiers from group ofp_hello_failed_code
827 OFPHFCIncompatible = 0 // OFPHFC_INCOMPATIBLE
828 OFPHFCEperm = 1 // OFPHFC_EPERM
829)
830
831type HelloFailedCode uint16
832
833func (self HelloFailedCode) MarshalJSON() ([]byte, error) {
834 return []byte(fmt.Sprintf("%d", self)), nil
835}
836
837const (
838 // Identifiers from group ofp_icmp_type
839 IcmpEchoreply = 0 // ICMP_ECHOREPLY
840 IcmpDestUnreach = 3 // ICMP_DEST_UNREACH
841 IcmpSourceQuench = 4 // ICMP_SOURCE_QUENCH
842 IcmpRedirect = 5 // ICMP_REDIRECT
843 IcmpEcho = 8 // ICMP_ECHO
844 IcmpTimeExceeded = 11 // ICMP_TIME_EXCEEDED
845 IcmpParameterprob = 12 // ICMP_PARAMETERPROB
846 IcmpTimestamp = 13 // ICMP_TIMESTAMP
847 IcmpTimestampreply = 14 // ICMP_TIMESTAMPREPLY
848 IcmpInfoRequest = 15 // ICMP_INFO_REQUEST
849 IcmpInfoReply = 16 // ICMP_INFO_REPLY
850 IcmpAddress = 17 // ICMP_ADDRESS
851 IcmpAddressreply = 18 // ICMP_ADDRESSREPLY
852)
853
854type IcmpType uint8
855
856func (self IcmpType) MarshalJSON() ([]byte, error) {
857 return []byte(fmt.Sprintf("\"%s\"", self)), nil
858}
859
860func (self IcmpType) String() string {
861 switch self {
862 case IcmpEchoreply:
863 return "echoreply"
864 case IcmpDestUnreach:
865 return "dest_unreach"
866 case IcmpSourceQuench:
867 return "source_quench"
868 case IcmpRedirect:
869 return "redirect"
870 case IcmpEcho:
871 return "echo"
872 case IcmpTimeExceeded:
873 return "time_exceeded"
874 case IcmpParameterprob:
875 return "parameterprob"
876 case IcmpTimestamp:
877 return "timestamp"
878 case IcmpTimestampreply:
879 return "timestampreply"
880 case IcmpInfoRequest:
881 return "info_request"
882 case IcmpInfoReply:
883 return "info_reply"
884 case IcmpAddress:
885 return "address"
886 case IcmpAddressreply:
887 return "addressreply"
888 default:
889 return fmt.Sprintf("%d", self)
890 }
891}
892
893const (
894 // Identifiers from group ofp_icmpv6_type
895 Icmpv6EchoRequest = 128 // ICMPV6_ECHO_REQUEST
896 Icmpv6EchoReply = 129 // ICMPV6_ECHO_REPLY
897 Icmpv6MgmQuery = 130 // ICMPV6_MGM_QUERY
898 Icmpv6MgmReport = 131 // ICMPV6_MGM_REPORT
899 Icmpv6MgmReduction = 132 // ICMPV6_MGM_REDUCTION
900 Icmpv6NiQuery = 139 // ICMPV6_NI_QUERY
901 Icmpv6NiReply = 140 // ICMPV6_NI_REPLY
902 Icmpv6Mld2Report = 143 // ICMPV6_MLD2_REPORT
903 Icmpv6DhaadRequest = 144 // ICMPV6_DHAAD_REQUEST
904 Icmpv6DhaadReply = 145 // ICMPV6_DHAAD_REPLY
905 Icmpv6MobilePrefixSol = 146 // ICMPV6_MOBILE_PREFIX_SOL
906 Icmpv6MobilePrefixAdv = 147 // ICMPV6_MOBILE_PREFIX_ADV
907)
908
909type Icmpv6Type uint8
910
911func (self Icmpv6Type) MarshalJSON() ([]byte, error) {
912 return []byte(fmt.Sprintf("\"%s\"", self)), nil
913}
914
915func (self Icmpv6Type) String() string {
916 switch self {
917 case Icmpv6EchoRequest:
918 return "echo_request"
919 case Icmpv6EchoReply:
920 return "echo_reply"
921 case Icmpv6MgmQuery:
922 return "mgm_query"
923 case Icmpv6MgmReport:
924 return "mgm_report"
925 case Icmpv6MgmReduction:
926 return "mgm_reduction"
927 case Icmpv6NiQuery:
928 return "ni_query"
929 case Icmpv6NiReply:
930 return "ni_reply"
931 case Icmpv6Mld2Report:
932 return "mld2_report"
933 case Icmpv6DhaadRequest:
934 return "dhaad_request"
935 case Icmpv6DhaadReply:
936 return "dhaad_reply"
937 case Icmpv6MobilePrefixSol:
938 return "mobile_prefix_sol"
939 case Icmpv6MobilePrefixAdv:
940 return "mobile_prefix_adv"
941 default:
942 return fmt.Sprintf("%d", self)
943 }
944}
945
946const (
947 // Identifiers from group ofp_ip_prototype
948 IpprotoIp = 0 // IPPROTO_IP
949 IpprotoICMP = 1 // IPPROTO_ICMP
950 IpprotoIgmp = 2 // IPPROTO_IGMP
951 IpprotoIpip = 4 // IPPROTO_IPIP
952 IpprotoTCP = 6 // IPPROTO_TCP
953 IpprotoEgp = 8 // IPPROTO_EGP
954 IpprotoPup = 12 // IPPROTO_PUP
955 IpprotoUdp = 17 // IPPROTO_UDP
956 IpprotoIdp = 22 // IPPROTO_IDP
957 IpprotoTp = 29 // IPPROTO_TP
958 IpprotoDccp = 33 // IPPROTO_DCCP
959 IpprotoIpv6 = 41 // IPPROTO_IPV6
960 IpprotoRsvp = 46 // IPPROTO_RSVP
961 IpprotoGRE = 47 // IPPROTO_GRE
962 IpprotoEsp = 50 // IPPROTO_ESP
963 IpprotoAh = 51 // IPPROTO_AH
964 IpprotoMtp = 92 // IPPROTO_MTP
965 IpprotoBeetph = 94 // IPPROTO_BEETPH
966 IpprotoEncap = 98 // IPPROTO_ENCAP
967 IpprotoPim = 103 // IPPROTO_PIM
968 IpprotoComp = 108 // IPPROTO_COMP
969 IpprotoSctp = 132 // IPPROTO_SCTP
970 IpprotoUdplite = 136 // IPPROTO_UDPLITE
971 IpprotoMpls = 137 // IPPROTO_MPLS
972 IpprotoRaw = 255 // IPPROTO_RAW
973 IpprotoRouting = 43 // IPPROTO_ROUTING
974 IpprotoFragment = 44 // IPPROTO_FRAGMENT
975 IpprotoIcmpv6 = 58 // IPPROTO_ICMPV6
976 IpprotoNone = 59 // IPPROTO_NONE
977 IpprotoDstopts = 60 // IPPROTO_DSTOPTS
978 IpprotoMh = 135 // IPPROTO_MH
979 IpprotoL2Tp = 115 // IPPROTO_L2TP
980)
981
982type IpPrototype uint8
983
984func (self IpPrototype) MarshalJSON() ([]byte, error) {
985 return []byte(fmt.Sprintf("\"%s\"", self)), nil
986}
987
988func (self IpPrototype) String() string {
989 switch self {
990 case IpprotoIp:
991 return "ip"
992 case IpprotoICMP:
993 return "icmp"
994 case IpprotoIgmp:
995 return "igmp"
996 case IpprotoIpip:
997 return "ipip"
998 case IpprotoTCP:
999 return "tcp"
1000 case IpprotoEgp:
1001 return "egp"
1002 case IpprotoPup:
1003 return "pup"
1004 case IpprotoUdp:
1005 return "udp"
1006 case IpprotoIdp:
1007 return "idp"
1008 case IpprotoTp:
1009 return "tp"
1010 case IpprotoDccp:
1011 return "dccp"
1012 case IpprotoIpv6:
1013 return "ipv6"
1014 case IpprotoRsvp:
1015 return "rsvp"
1016 case IpprotoGRE:
1017 return "gre"
1018 case IpprotoEsp:
1019 return "esp"
1020 case IpprotoAh:
1021 return "ah"
1022 case IpprotoMtp:
1023 return "mtp"
1024 case IpprotoBeetph:
1025 return "beetph"
1026 case IpprotoEncap:
1027 return "encap"
1028 case IpprotoPim:
1029 return "pim"
1030 case IpprotoComp:
1031 return "comp"
1032 case IpprotoSctp:
1033 return "sctp"
1034 case IpprotoUdplite:
1035 return "udplite"
1036 case IpprotoMpls:
1037 return "mpls"
1038 case IpprotoRaw:
1039 return "raw"
1040 case IpprotoRouting:
1041 return "routing"
1042 case IpprotoFragment:
1043 return "fragment"
1044 case IpprotoIcmpv6:
1045 return "icmpv6"
1046 case IpprotoNone:
1047 return "none"
1048 case IpprotoDstopts:
1049 return "dstopts"
1050 case IpprotoMh:
1051 return "mh"
1052 case IpprotoL2Tp:
1053 return "l2tp"
1054 default:
1055 return fmt.Sprintf("%d", self)
1056 }
1057}
1058
1059const (
1060 // Identifiers from group ofp_nicira_controller_role
1061 NxRoleOther = 0 // NX_ROLE_OTHER
1062 NxRoleMaster = 1 // NX_ROLE_MASTER
1063 NxRoleSlave = 2 // NX_ROLE_SLAVE
1064)
1065
1066type NiciraControllerRole uint32
1067
1068func (self NiciraControllerRole) MarshalJSON() ([]byte, error) {
1069 return []byte(fmt.Sprintf("%d", self)), nil
1070}
1071
1072const (
1073 // Identifiers from group ofp_packet_in_reason
1074 OFPRNoMatch = 0 // OFPR_NO_MATCH
1075 OFPRAction = 1 // OFPR_ACTION
1076)
1077
1078type PacketInReason uint8
1079
1080func (self PacketInReason) MarshalJSON() ([]byte, error) {
1081 return []byte(fmt.Sprintf("%d", self)), nil
1082}
1083
1084const (
1085 // Identifiers from group ofp_packet_type
1086 PtEthernet = 0 // OFP_PT_ETHERNET
1087 PtUseNextProto = 65534 // OFP_PT_USE_NEXT_PROTO
1088 PtIpv4 = 67584 // OFP_PT_IPV4
1089 PtMpls = 100423 // OFP_PT_MPLS
1090 PtMplsMc = 100424 // OFP_PT_MPLS_MC
1091 PtNsh = 100687 // OFP_PT_NSH
1092 PtUnknown = 4294967295 // OFP_PT_UNKNOWN
1093)
1094
1095type PacketType uint32
1096
1097func (self PacketType) MarshalJSON() ([]byte, error) {
1098 return []byte(fmt.Sprintf("\"%s\"", self)), nil
1099}
1100
1101func (self PacketType) String() string {
1102 switch self {
1103 case PtEthernet:
1104 return "ethernet"
1105 case PtUseNextProto:
1106 return "use_next_proto"
1107 case PtIpv4:
1108 return "ipv4"
1109 case PtMpls:
1110 return "mpls"
1111 case PtMplsMc:
1112 return "mpls_mc"
1113 case PtNsh:
1114 return "nsh"
1115 case PtUnknown:
1116 return "unknown"
1117 default:
1118 return fmt.Sprintf("%d", self)
1119 }
1120}
1121
1122const (
1123 // Identifiers from group ofp_port
1124 OFPPMax = 0xff00 // OFPP_MAX
1125 OFPPInPort = 0xfff8 // OFPP_IN_PORT
1126 OFPPTable = 0xfff9 // OFPP_TABLE
1127 OFPPNormal = 0xfffa // OFPP_NORMAL
1128 OFPPFlood = 0xfffb // OFPP_FLOOD
1129 OFPPAll = 0xfffc // OFPP_ALL
1130 OFPPController = 0xfffd // OFPP_CONTROLLER
1131 OFPPLocal = 0xfffe // OFPP_LOCAL
1132 OFPPNone = 0xffff // OFPP_NONE
1133)
1134
1135type Port uint16
1136
1137func (self Port) MarshalJSON() ([]byte, error) {
1138 return []byte(fmt.Sprintf("%d", self)), nil
1139}
1140
1141const (
1142 // Identifiers from group ofp_port_config
1143 OFPPCPortDown = 1 // OFPPC_PORT_DOWN
1144 OFPPCNoSTP = 2 // OFPPC_NO_STP
1145 OFPPCNoRecv = 4 // OFPPC_NO_RECV
1146 OFPPCNoRecvSTP = 8 // OFPPC_NO_RECV_STP
1147 OFPPCNoFlood = 16 // OFPPC_NO_FLOOD
1148 OFPPCNoFwd = 32 // OFPPC_NO_FWD
1149 OFPPCNoPacketIn = 64 // OFPPC_NO_PACKET_IN
1150 OFPPCBSNMirrorDest = 2147483648 // OFPPC_BSN_MIRROR_DEST
1151)
1152
1153type PortConfig uint32
1154
1155func (self PortConfig) MarshalJSON() ([]byte, error) {
1156 var flags []string
1157 if self&OFPPCPortDown == OFPPCPortDown {
1158 flags = append(flags, "\"PortDown\": true")
1159 }
1160 if self&OFPPCNoSTP == OFPPCNoSTP {
1161 flags = append(flags, "\"NoSTP\": true")
1162 }
1163 if self&OFPPCNoRecv == OFPPCNoRecv {
1164 flags = append(flags, "\"NoRecv\": true")
1165 }
1166 if self&OFPPCNoRecvSTP == OFPPCNoRecvSTP {
1167 flags = append(flags, "\"NoRecvSTP\": true")
1168 }
1169 if self&OFPPCNoFlood == OFPPCNoFlood {
1170 flags = append(flags, "\"NoFlood\": true")
1171 }
1172 if self&OFPPCNoFwd == OFPPCNoFwd {
1173 flags = append(flags, "\"NoFwd\": true")
1174 }
1175 if self&OFPPCNoPacketIn == OFPPCNoPacketIn {
1176 flags = append(flags, "\"NoPacketIn\": true")
1177 }
1178 if self&OFPPCBSNMirrorDest == OFPPCBSNMirrorDest {
1179 flags = append(flags, "\"BsnMirrorDest\": true")
1180 }
1181 return []byte("{" + strings.Join(flags, ", ") + "}"), nil
1182}
1183
1184const (
1185 // Identifiers from group ofp_port_features
1186 OFPPF10MbHd = 1 // OFPPF_10MB_HD
1187 OFPPF10MbFd = 2 // OFPPF_10MB_FD
1188 OFPPF100MbHd = 4 // OFPPF_100MB_HD
1189 OFPPF100MbFd = 8 // OFPPF_100MB_FD
1190 OFPPF1GbHd = 16 // OFPPF_1GB_HD
1191 OFPPF1GbFd = 32 // OFPPF_1GB_FD
1192 OFPPF10GbFd = 64 // OFPPF_10GB_FD
1193 OFPPFCopper = 128 // OFPPF_COPPER
1194 OFPPFFiber = 256 // OFPPF_FIBER
1195 OFPPFAutoneg = 512 // OFPPF_AUTONEG
1196 OFPPFPause = 1024 // OFPPF_PAUSE
1197 OFPPFPauseAsym = 2048 // OFPPF_PAUSE_ASYM
1198)
1199
1200type PortFeatures uint32
1201
1202func (self PortFeatures) MarshalJSON() ([]byte, error) {
1203 var flags []string
1204 if self&OFPPF10MbHd == OFPPF10MbHd {
1205 flags = append(flags, "\"10MbHd\": true")
1206 }
1207 if self&OFPPF10MbFd == OFPPF10MbFd {
1208 flags = append(flags, "\"10MbFd\": true")
1209 }
1210 if self&OFPPF100MbHd == OFPPF100MbHd {
1211 flags = append(flags, "\"100MbHd\": true")
1212 }
1213 if self&OFPPF100MbFd == OFPPF100MbFd {
1214 flags = append(flags, "\"100MbFd\": true")
1215 }
1216 if self&OFPPF1GbHd == OFPPF1GbHd {
1217 flags = append(flags, "\"1GbHd\": true")
1218 }
1219 if self&OFPPF1GbFd == OFPPF1GbFd {
1220 flags = append(flags, "\"1GbFd\": true")
1221 }
1222 if self&OFPPF10GbFd == OFPPF10GbFd {
1223 flags = append(flags, "\"10GbFd\": true")
1224 }
1225 if self&OFPPFCopper == OFPPFCopper {
1226 flags = append(flags, "\"Copper\": true")
1227 }
1228 if self&OFPPFFiber == OFPPFFiber {
1229 flags = append(flags, "\"Fiber\": true")
1230 }
1231 if self&OFPPFAutoneg == OFPPFAutoneg {
1232 flags = append(flags, "\"Autoneg\": true")
1233 }
1234 if self&OFPPFPause == OFPPFPause {
1235 flags = append(flags, "\"Pause\": true")
1236 }
1237 if self&OFPPFPauseAsym == OFPPFPauseAsym {
1238 flags = append(flags, "\"PauseAsym\": true")
1239 }
1240 return []byte("{" + strings.Join(flags, ", ") + "}"), nil
1241}
1242
1243const (
1244 // Identifiers from group ofp_port_mod_failed_code
1245 OFPPMFCBadPort = 0 // OFPPMFC_BAD_PORT
1246 OFPPMFCBadHwAddr = 1 // OFPPMFC_BAD_HW_ADDR
1247)
1248
1249type PortModFailedCode uint16
1250
1251func (self PortModFailedCode) MarshalJSON() ([]byte, error) {
1252 return []byte(fmt.Sprintf("%d", self)), nil
1253}
1254
1255const (
1256 // Identifiers from group ofp_port_reason
1257 OFPPRAdd = 0 // OFPPR_ADD
1258 OFPPRDelete = 1 // OFPPR_DELETE
1259 OFPPRModify = 2 // OFPPR_MODIFY
1260)
1261
1262type PortReason uint8
1263
1264func (self PortReason) MarshalJSON() ([]byte, error) {
1265 return []byte(fmt.Sprintf("%d", self)), nil
1266}
1267
1268const (
1269 // Identifiers from group ofp_port_state
1270 OFPPSLinkDown = 1 // OFPPS_LINK_DOWN
1271 OFPPSSTPListen = 0 // OFPPS_STP_LISTEN
1272 OFPPSSTPLearn = 256 // OFPPS_STP_LEARN
1273 OFPPSSTPForward = 512 // OFPPS_STP_FORWARD
1274 OFPPSSTPBlock = 768 // OFPPS_STP_BLOCK
1275 OFPPSSTPMask = 768 // OFPPS_STP_MASK
1276)
1277
1278type PortState uint32
1279
1280func (self PortState) MarshalJSON() ([]byte, error) {
1281 var flags []string
1282 if self&OFPPSLinkDown == OFPPSLinkDown {
1283 flags = append(flags, "\"LinkDown\": true")
1284 }
1285 if self&OFPPSSTPListen == OFPPSSTPListen {
1286 flags = append(flags, "\"StpListen\": true")
1287 }
1288 if self&OFPPSSTPLearn == OFPPSSTPLearn {
1289 flags = append(flags, "\"StpLearn\": true")
1290 }
1291 if self&OFPPSSTPForward == OFPPSSTPForward {
1292 flags = append(flags, "\"StpForward\": true")
1293 }
1294 if self&OFPPSSTPBlock == OFPPSSTPBlock {
1295 flags = append(flags, "\"StpBlock\": true")
1296 }
1297 if self&OFPPSSTPMask == OFPPSSTPMask {
1298 flags = append(flags, "\"StpMask\": true")
1299 }
1300 return []byte("{" + strings.Join(flags, ", ") + "}"), nil
1301}
1302
1303const (
1304 // Identifiers from group ofp_queue_op_failed_code
1305 OFPQOFCBadPort = 0 // OFPQOFC_BAD_PORT
1306 OFPQOFCBadQueue = 1 // OFPQOFC_BAD_QUEUE
1307 OFPQOFCEperm = 2 // OFPQOFC_EPERM
1308)
1309
1310type QueueOpFailedCode uint16
1311
1312func (self QueueOpFailedCode) MarshalJSON() ([]byte, error) {
1313 return []byte(fmt.Sprintf("%d", self)), nil
1314}
1315
1316const (
1317 // Identifiers from group ofp_queue_properties
1318 OFPQTNone = 0 // OFPQT_NONE
1319 OFPQTMinRate = 1 // OFPQT_MIN_RATE
1320)
1321
1322type QueueProperties uint32
1323
1324func (self QueueProperties) MarshalJSON() ([]byte, error) {
1325 return []byte(fmt.Sprintf("%d", self)), nil
1326}
1327
1328const (
1329 // Identifiers from group ofp_stats_reply_flags
1330 OFPSFReplyMore = 1 // OFPSF_REPLY_MORE
1331)
1332
1333type StatsReplyFlags uint16
1334
1335func (self StatsReplyFlags) MarshalJSON() ([]byte, error) {
1336 var flags []string
1337 if self&OFPSFReplyMore == OFPSFReplyMore {
1338 flags = append(flags, "\"OFPSFReplyMore\": true")
1339 }
1340 return []byte("{" + strings.Join(flags, ", ") + "}"), nil
1341}
1342
1343const (
1344// Identifiers from group ofp_stats_request_flags
1345)
1346
1347type StatsRequestFlags uint16
1348
1349func (self StatsRequestFlags) MarshalJSON() ([]byte, error) {
1350 var flags []string
1351 return []byte("{" + strings.Join(flags, ", ") + "}"), nil
1352}
1353
1354const (
1355 // Identifiers from group ofp_stats_type
1356 OFPSTDesc = 0 // OFPST_DESC
1357 OFPSTFlow = 1 // OFPST_FLOW
1358 OFPSTAggregate = 2 // OFPST_AGGREGATE
1359 OFPSTTable = 3 // OFPST_TABLE
1360 OFPSTPort = 4 // OFPST_PORT
1361 OFPSTQueue = 5 // OFPST_QUEUE
1362 OFPSTExperimenter = 65535 // OFPST_EXPERIMENTER
1363)
1364
1365type StatsType uint16
1366
1367func (self StatsType) MarshalJSON() ([]byte, error) {
1368 return []byte(fmt.Sprintf("%d", self)), nil
1369}
1370
1371const (
1372 // Identifiers from group ofp_tcp_flags
1373 TcpFlagCwr = 128 // TCP_FLAG_CWR
1374 TcpFlagEce = 64 // TCP_FLAG_ECE
1375 TcpFlagUrg = 32 // TCP_FLAG_URG
1376 TcpFlagAck = 16 // TCP_FLAG_ACK
1377 TcpFlagPsh = 8 // TCP_FLAG_PSH
1378 TcpFlagRst = 4 // TCP_FLAG_RST
1379 TcpFlagSyn = 2 // TCP_FLAG_SYN
1380 TcpFlagFin = 1 // TCP_FLAG_FIN
1381)
1382
1383type TcpFlags uint16
1384
1385func (self TcpFlags) MarshalJSON() ([]byte, error) {
1386 var flags []string
1387 if self&TcpFlagCwr == TcpFlagCwr {
1388 flags = append(flags, "\"Cwr\": true")
1389 }
1390 if self&TcpFlagEce == TcpFlagEce {
1391 flags = append(flags, "\"Ece\": true")
1392 }
1393 if self&TcpFlagUrg == TcpFlagUrg {
1394 flags = append(flags, "\"Urg\": true")
1395 }
1396 if self&TcpFlagAck == TcpFlagAck {
1397 flags = append(flags, "\"Ack\": true")
1398 }
1399 if self&TcpFlagPsh == TcpFlagPsh {
1400 flags = append(flags, "\"Psh\": true")
1401 }
1402 if self&TcpFlagRst == TcpFlagRst {
1403 flags = append(flags, "\"Rst\": true")
1404 }
1405 if self&TcpFlagSyn == TcpFlagSyn {
1406 flags = append(flags, "\"Syn\": true")
1407 }
1408 if self&TcpFlagFin == TcpFlagFin {
1409 flags = append(flags, "\"Fin\": true")
1410 }
1411 return []byte("{" + strings.Join(flags, ", ") + "}"), nil
1412}
1413
1414const (
1415 // Identifiers from group ofp_type
1416 OFPTHello = 0 // OFPT_HELLO
1417 OFPTError = 1 // OFPT_ERROR
1418 OFPTEchoRequest = 2 // OFPT_ECHO_REQUEST
1419 OFPTEchoReply = 3 // OFPT_ECHO_REPLY
1420 OFPTExperimenter = 4 // OFPT_EXPERIMENTER
1421 OFPTFeaturesRequest = 5 // OFPT_FEATURES_REQUEST
1422 OFPTFeaturesReply = 6 // OFPT_FEATURES_REPLY
1423 OFPTGetConfigRequest = 7 // OFPT_GET_CONFIG_REQUEST
1424 OFPTGetConfigReply = 8 // OFPT_GET_CONFIG_REPLY
1425 OFPTSetConfig = 9 // OFPT_SET_CONFIG
1426 OFPTPacketIn = 10 // OFPT_PACKET_IN
1427 OFPTFlowRemoved = 11 // OFPT_FLOW_REMOVED
1428 OFPTPortStatus = 12 // OFPT_PORT_STATUS
1429 OFPTPacketOut = 13 // OFPT_PACKET_OUT
1430 OFPTFlowMod = 14 // OFPT_FLOW_MOD
1431 OFPTPortMod = 15 // OFPT_PORT_MOD
1432 OFPTStatsRequest = 16 // OFPT_STATS_REQUEST
1433 OFPTStatsReply = 17 // OFPT_STATS_REPLY
1434 OFPTBarrierRequest = 18 // OFPT_BARRIER_REQUEST
1435 OFPTBarrierReply = 19 // OFPT_BARRIER_REPLY
1436 OFPTQueueGetConfigRequest = 20 // OFPT_QUEUE_GET_CONFIG_REQUEST
1437 OFPTQueueGetConfigReply = 21 // OFPT_QUEUE_GET_CONFIG_REPLY
1438)
1439
1440type Type uint8
1441
1442func (self Type) MarshalJSON() ([]byte, error) {
1443 return []byte(fmt.Sprintf("\"%s\"", self)), nil
1444}
1445
1446func (self Type) String() string {
1447 switch self {
1448 case OFPTHello:
1449 return "hello"
1450 case OFPTError:
1451 return "error"
1452 case OFPTEchoRequest:
1453 return "echo_request"
1454 case OFPTEchoReply:
1455 return "echo_reply"
1456 case OFPTExperimenter:
1457 return "experimenter"
1458 case OFPTFeaturesRequest:
1459 return "features_request"
1460 case OFPTFeaturesReply:
1461 return "features_reply"
1462 case OFPTGetConfigRequest:
1463 return "get_config_request"
1464 case OFPTGetConfigReply:
1465 return "get_config_reply"
1466 case OFPTSetConfig:
1467 return "set_config"
1468 case OFPTPacketIn:
1469 return "packet_in"
1470 case OFPTFlowRemoved:
1471 return "flow_removed"
1472 case OFPTPortStatus:
1473 return "port_status"
1474 case OFPTPacketOut:
1475 return "packet_out"
1476 case OFPTFlowMod:
1477 return "flow_mod"
1478 case OFPTPortMod:
1479 return "port_mod"
1480 case OFPTStatsRequest:
1481 return "stats_request"
1482 case OFPTStatsReply:
1483 return "stats_reply"
1484 case OFPTBarrierRequest:
1485 return "barrier_request"
1486 case OFPTBarrierReply:
1487 return "barrier_reply"
1488 case OFPTQueueGetConfigRequest:
1489 return "queue_get_config_request"
1490 case OFPTQueueGetConfigReply:
1491 return "queue_get_config_reply"
1492 default:
1493 return fmt.Sprintf("%d", self)
1494 }
1495}