Skip to content

Commit a0233f5

Browse files
committed
Merge pull request #179 from robertsoule/sexp-pattern
Added with sexp serialization to pattern type.
2 parents 1709e7a + d08a629 commit a0233f5

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

lib/OpenFlow0x01_Core.ml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
open Packet
2+
open Core.Std
23

3-
type 'a mask = { m_value : 'a; m_mask : 'a option }
4+
type 'a mask = { m_value : 'a; m_mask : 'a option } with sexp
45

5-
type switchId = int64
6+
type switchId = int64 with sexp
67

7-
type portId = int16
8+
type portId = int16 with sexp
89

9-
type queueId = int32
10+
type queueId = int32 with sexp
1011

1112
type xid = OpenFlow_Header.xid
1213

@@ -22,7 +23,7 @@ type pattern =
2223
; nwTos : nwTos option
2324
; tpSrc : tpPort option
2425
; tpDst : tpPort option
25-
; inPort : portId option }
26+
; inPort : portId option } with sexp
2627

2728
type pseudoPort =
2829
| PhysicalPort of portId

lib/OpenFlow0x01_Core.mli

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,25 @@ Most data structures are documented with a pointer to relevent section in the
88
OpenFlow 1.0 specification, rather than reproducing the specification here. *)
99

1010
open Packet
11+
open Core.Std
1112

1213
(** {2 OpenFlow types}
1314
1415
These types are primarily drawn from Section 5 of the OpenFlow 1.0
1516
specification.
1617
*)
1718

18-
type 'a mask = { m_value : 'a; m_mask : 'a option }
19+
type 'a mask = { m_value : 'a; m_mask : 'a option } with sexp
1920

2021
(** [switchId] is the type of switch identifiers received as part of
2122
[SwitchFeature] replies. *)
22-
type switchId = int64
23+
type switchId = int64 with sexp
2324

2425
(** [portId] is the type of physical port identifiers (port numbers). *)
25-
type portId = int16
26+
type portId = int16 with sexp
2627

2728
(** [queueId] identifies a specific queue for QoS. *)
28-
type queueId = int32
29+
type queueId = int32 with sexp
2930

3031
(** Transaction ID of OpenFlow messages. *)
3132
type xid = OpenFlow_Header.xid
@@ -47,7 +48,7 @@ type pattern =
4748
; tpSrc : tpPort option (** TCP/UDP source port. *)
4849
; tpDst : tpPort option (** TCP/UDP destination port. *)
4950
; inPort : portId option (** Input switch port. *)
50-
}
51+
} with sexp
5152

5253
(** A pseudo-port, as described by the [ofp_port] enumeration in
5354
Section 5.2.1 of the OpenFlow 1.0 specification. *)

0 commit comments

Comments
 (0)