Skip to content

Commit 4f2f4a7

Browse files
committed
add to_string function for messages
1 parent 5987278 commit 4f2f4a7

File tree

1 file changed

+24
-24
lines changed

1 file changed

+24
-24
lines changed

lib/OpenFlow0x04.ml

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -6811,15 +6811,15 @@ module Message = struct
68116811
| EchoRequest bytes -> Header.size + (String.length (Cstruct.to_string bytes))
68126812
| EchoReply bytes -> Header.size + (String.length (Cstruct.to_string bytes))
68136813
| FeaturesRequest -> Header.size
6814-
| FeaturesReply _ -> Header.size + sizeof_ofp_switch_features
6814+
| FeaturesReply f -> Header.size + SwitchFeatures.sizeof f
68156815
| FlowModMsg fm -> Header.size + FlowMod.sizeof fm
68166816
| GroupModMsg gm -> Header.size + GroupMod.sizeof gm
68176817
| PortModMsg pm -> Header.size + PortMod.sizeof pm
68186818
| MeterModMsg mm -> Header.size + MeterMod.sizeof mm
68196819
| PacketInMsg pi -> Header.size + PacketIn.sizeof pi
68206820
| FlowRemoved fr -> Header.size + FlowRemoved.sizeof fr
68216821
| PacketOutMsg po -> Header.size + PacketOut.sizeof po
6822-
| PortStatusMsg _ -> Header.size + sizeof_ofp_port_status + sizeof_ofp_port
6822+
| PortStatusMsg p -> Header.size + PortStatus.sizeof p
68236823
| MultipartReq req -> Header.size + MultipartReq.sizeof req
68246824
| MultipartReply rep -> Header.size + MultipartReply.sizeof rep
68256825
| QueueGetConfigReq qc -> Header.size + QueueConfReq.sizeof qc
@@ -6838,35 +6838,35 @@ module Message = struct
68386838
| RoleReply rr -> Header.size + RoleRequest.sizeof rr
68396839

68406840
let to_string (msg : t) : string = match msg with
6841-
| Hello _ -> "Hello"
6842-
| Error _ -> "Error"
6841+
| Hello hello -> Format.sprintf "Hello = %s" (Hello.to_string hello)
6842+
| Error error -> Format.sprintf "Error = %s" (Error.to_string error)
68436843
| EchoRequest _ -> "EchoRequest"
68446844
| EchoReply _ -> "EchoReply"
68456845
| FeaturesRequest -> "FeaturesRequest"
6846-
| FeaturesReply _ -> "FeaturesReply"
6847-
| FlowModMsg _ -> "FlowMod"
6848-
| GroupModMsg _ -> "GroupMod"
6849-
| PortModMsg _ -> "PortMod"
6850-
| MeterModMsg _ -> "MeterMod"
6851-
| PacketInMsg _ -> "PacketIn"
6852-
| FlowRemoved _ -> "FlowRemoved"
6853-
| PacketOutMsg _ -> "PacketOut"
6854-
| PortStatusMsg _ -> "PortStatus"
6855-
| MultipartReq _ -> "MultipartRequest"
6856-
| MultipartReply _ -> "MultipartReply"
6846+
| FeaturesReply features -> Format.sprintf "FeaturesReply = %s" (SwitchFeatures.to_string features)
6847+
| FlowModMsg flow -> Format.sprintf "FlowMod = %s" (FlowMod.to_string flow)
6848+
| GroupModMsg group -> Format.sprintf "GroupMod = %s" (GroupMod.to_string group)
6849+
| PortModMsg port -> Format.sprintf "PortMod = %s" (PortMod.to_string port)
6850+
| MeterModMsg meter -> Format.sprintf "MeterMod = %s" (MeterMod.to_string meter)
6851+
| PacketInMsg packet -> Format.sprintf "PacketIn = %s" (PacketIn.to_string packet)
6852+
| FlowRemoved flow -> Format.sprintf "FlowRemoved = %s" (FlowRemoved.to_string flow)
6853+
| PacketOutMsg packet -> Format.sprintf "PacketOut = %s" (PacketOut.to_string packet)
6854+
| PortStatusMsg port -> Format.sprintf "PortStatus = %s" (PortStatus.to_string port)
6855+
| MultipartReq mult -> Format.sprintf "MultipartRequest = %s" (MultipartReq.to_string mult)
6856+
| MultipartReply mult -> Format.sprintf "MultipartReply = %s" (MultipartReply.to_string mult)
68576857
| BarrierRequest -> "BarrierRequest"
68586858
| BarrierReply -> "BarrierReply"
6859-
| RoleRequest _ -> "RoleRequest"
6860-
| RoleReply _ -> "RoleReply"
6861-
| QueueGetConfigReq _ -> "QueueGetConfigReq"
6862-
| QueueGetConfigReply _ -> "QueueGetConfigReply"
6859+
| RoleRequest role -> Format.sprintf "RoleRequest = %s" (RoleRequest.to_string role)
6860+
| RoleReply role -> Format.sprintf "RoleReply = %s" (RoleRequest.to_string role)
6861+
| QueueGetConfigReq queue -> Format.sprintf "QueueGetConfigReq = %s" (QueueConfReq.to_string queue)
6862+
| QueueGetConfigReply queue -> Format.sprintf "QueueGetConfigReply = %s" (QueueConfReply.to_string queue)
68636863
| GetConfigRequestMsg -> "GetConfigRequest"
6864-
| GetConfigReplyMsg _ -> "GetConfigReply"
6865-
| SetConfigMsg _ -> "SetConfig"
6866-
| TableModMsg _ -> "TableMod"
6864+
| GetConfigReplyMsg conf -> Format.sprintf "GetConfigReply = %s" (SwitchConfig.to_string conf)
6865+
| SetConfigMsg conf -> Format.sprintf "SetConfig = %s" (SwitchConfig.to_string conf)
6866+
| TableModMsg table -> Format.sprintf "TableMod = %s" (TableMod.to_string table)
68676867
| GetAsyncRequest -> "GetAsyncRequest"
6868-
| GetAsyncReply _ -> "GetAsyncReply"
6869-
| SetAsync _ -> "SetAsync"
6868+
| GetAsyncReply async -> Format.sprintf "GetAsyncReply = %s" (AsyncConfig.to_string async)
6869+
| SetAsync async -> Format.sprintf "SetAsync = %s" (AsyncConfig.to_string async)
68706870

68716871
(* let marshal (buf : Cstruct.t) (msg : message) : int = *)
68726872
(* let buf2 = (Cstruct.shift buf Header.size) in *)

0 commit comments

Comments
 (0)