Skip to content

Commit 5b37186

Browse files
committed
Merge branch 'master' into multi
Conflicts: setup.ml
2 parents c2c5b74 + 53e51e5 commit 5b37186

File tree

6 files changed

+65
-35
lines changed

6 files changed

+65
-35
lines changed

_oasis

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
OASISFormat: 0.3
22
OCamlVersion: >= 4.01.0
33
Name: openflow
4-
Version: 0.6.0
4+
Version: 0.6.2
55
Synopsis: Serialization library for OpenFlow
66
Authors: https://github.com/frenetic-lang/ocaml-openflow/contributors
77
License: LGPL

async/Async_OpenFlow.mli

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@ module Log : sig
77

88
include Log.Global_intf
99

10+
val of_lazy
11+
: ?level:[ `Debug | `Info | `Error ]
12+
-> ?time:Time.t
13+
-> ?tags:(string * string) list
14+
-> string Lazy.t
15+
-> unit
16+
1017
val make_filtered_output : (string * string) list ->
1118
Log.Output.t
1219

async/Async_OpenFlow_Log.ml

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ let stderr : Log.Output.t =
4646

4747
let log = lazy (Log.create ~level:`Info ~output:[stderr])
4848

49+
let level () = Log.level (Lazy.force log)
4950
let set_level = Log.set_level (Lazy.force log)
5051

5152
let set_output outputs = current_outputs := outputs;
@@ -56,24 +57,33 @@ let add_output outputs =
5657
current_outputs := outputs;
5758
set_output outputs
5859

59-
let raw ?(tags=[]) fmt = Log.raw (Lazy.force log) ~tags fmt
60+
let raw ?time ?(tags=[]) fmt = Log.raw (Lazy.force log) ?time ~tags fmt
6061

61-
let info ?(tags=[]) fmt = Log.info (Lazy.force log) ~tags fmt
62+
let info ?time ?(tags=[]) fmt = Log.info (Lazy.force log) ?time ~tags fmt
6263

63-
let error ?(tags=[]) fmt = Log.error (Lazy.force log) ~tags fmt
64+
let error ?time ?(tags=[]) fmt = Log.error (Lazy.force log) ?time ~tags fmt
6465

65-
let debug ?(tags=[]) fmt = Log.debug (Lazy.force log) ~tags fmt
66+
let debug ?time ?(tags=[]) fmt = Log.debug (Lazy.force log) ?time ~tags fmt
6667

6768
let flushed () =
6869
Log.flushed (Lazy.force log)
6970

70-
let printf ?(tags=[]) ?(level=`Debug) fmt =
71+
let printf ?(level=`Debug) ?time ?(tags=[]) fmt =
7172
Log.printf (Lazy.force log) ~tags ~level fmt
7273

73-
let of_lazy ?(tags=[]) ?(level=`Debug) lazy_str =
74-
Log.of_lazy (Lazy.force log) ~tags ~level lazy_str
74+
let of_lazy ?(level=`Debug) ?time ?(tags=[]) lazy_str =
75+
(* As of core/async.111.25.00, `Log.of_lazy` is no longer part of that
76+
* package's public API. In 111.28.00, the `Log.level` call was added,
77+
* allowing users of the package to implement `of_lazy` without having to
78+
* manage the log level manually.
79+
* *)
80+
if level = Log.level (Lazy.force log) then
81+
Log.printf (Lazy.force log) ~tags ~level "%s" (Lazy.force lazy_str)
7582

76-
let sexp ?(tags=[]) ?(level=`Debug) msg =
77-
Log.sexp (Lazy.force log) ~tags ~level msg
83+
let sexp ?(level=`Debug) ?time ?(tags=[]) msg =
84+
Log.sexp (Lazy.force log) ~tags ~level msg
85+
86+
let string ?(level=`Debug) ?time ?(tags=[]) str =
87+
Log.string (Lazy.force log) ~tags ~level str
7888

7989
let message = Log.message (Lazy.force log)

lib/META

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# OASIS_START
2-
# DO NOT EDIT (digest: 70d46b868aee1843635d9d187dfc1041)
3-
version = "0.6.0"
2+
# DO NOT EDIT (digest: 03c6aa4eb5311c099a1fb8ca2157a81f)
3+
version = "0.6.2"
44
description = "Serialization library for OpenFlow"
55
requires =
66
"str cstruct cstruct.syntax packet core sexplib.syntax sexplib threads"
@@ -10,7 +10,7 @@ archive(native) = "openflow.cmxa"
1010
archive(native, plugin) = "openflow.cmxs"
1111
exists_if = "openflow.cma"
1212
package "quickcheck" (
13-
version = "0.6.0"
13+
version = "0.6.2"
1414
description = "Serialization library for OpenFlow"
1515
requires = "quickcheck openflow packet.quickcheck"
1616
archive(byte) = "quickcheck.cma"
@@ -21,7 +21,7 @@ package "quickcheck" (
2121
)
2222

2323
package "async" (
24-
version = "0.6.0"
24+
version = "0.6.2"
2525
description = "Serialization library for OpenFlow"
2626
requires = "async openflow cstruct.async threads sexplib.syntax sexplib"
2727
archive(byte) = "async.cma"

lib/SDN_OpenFlow0x01.ml

Lines changed: 31 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ module AL = SDN_Types
22
module Core = OpenFlow0x01_Core
33
module Msg = OpenFlow0x01.Message
44

5-
65
exception Invalid_port of int32
76

87
let from_portId (pport_id : AL.portId) : Core.portId =
@@ -48,13 +47,23 @@ let from_pattern (pat : AL.Pattern.t) : Core.pattern =
4847
| None -> None)
4948
; Core.dlVlanPcp = pat.AL.Pattern.dlVlanPcp
5049
; Core.nwSrc = (match pat.AL.Pattern.nwSrc with
51-
| None -> None
52-
| Some (p,m) -> let mo = if m = 32l then None else Some m in
53-
Some { Core.m_value = p; Core.m_mask = mo })
50+
| None -> None
51+
| Some (p,m) ->
52+
let mo =
53+
if m = 32l then
54+
None
55+
else
56+
Some (Int32.sub 32l m) in
57+
Some { Core.m_value = p; Core.m_mask = mo })
5458
; Core.nwDst = (match pat.AL.Pattern.nwDst with
55-
| None -> None
56-
| Some (p,m) -> let mo = if m = 32l then None else Some m in
57-
Some { Core.m_value = p; Core.m_mask = mo })
59+
| None -> None
60+
| Some (p,m) ->
61+
let mo =
62+
if m = 32l then
63+
None
64+
else
65+
Some (Int32.sub 32l m) in
66+
Some { Core.m_value = p; Core.m_mask = mo })
5867
; Core.nwProto = pat.AL.Pattern.nwProto
5968
; Core.nwTos = None
6069
; Core.tpSrc = pat.AL.Pattern.tpSrc
@@ -82,11 +91,11 @@ module Common = HighLevelSwitch_common.Make (struct
8291
| AL.All ->
8392
(Mod.none, Output AllPorts)
8493
| AL.Physical pport_id ->
85-
let pport_id = from_portId pport_id in
86-
if Some pport_id = inPort then
87-
(Mod.none, Output InPort)
88-
else
89-
(Mod.none, Output (PhysicalPort pport_id))
94+
let pport_id = from_portId pport_id in
95+
if Some pport_id = inPort then
96+
(Mod.none, Output InPort)
97+
else
98+
(Mod.none, Output (PhysicalPort pport_id))
9099
| AL.Controller n ->
91100
(Mod.none, Output (Controller n))
92101
| AL.Local ->
@@ -119,30 +128,34 @@ module Common = HighLevelSwitch_common.Make (struct
119128
end
120129
| AL.Modify (AL.SetVlanPcp pcp) ->
121130
(Mod.dlVlanPcp, SetDlVlanPcp(VInt.(get_int4 (Int4 pcp))))
122-
| AL.Modify (AL.SetEthTyp _) -> raise (Invalid_argument "cannot set Ethernet type")
123-
| AL.Modify (AL.SetIPProto _) -> raise (Invalid_argument "cannot set IP protocol")
131+
| AL.Modify (AL.SetEthTyp _) ->
132+
raise (Invalid_argument "cannot set Ethernet type")
133+
| AL.Modify (AL.SetIPProto _) ->
134+
raise (Invalid_argument "cannot set IP protocol")
124135
| AL.Modify (AL.SetIP4Src nwAddr) ->
125136
(Mod.nwSrc, SetNwSrc nwAddr)
126137
| AL.Modify (AL.SetIP4Dst nwAddr) ->
127138
(Mod.nwDst, SetNwDst nwAddr)
128139
| AL.Modify (AL.SetTCPSrcPort tp) ->
129-
(Mod.tpSrc, SetTpSrc VInt.(get_int16 (Int16 tp)))
140+
(Mod.tpSrc, SetTpSrc VInt.(get_int16 (Int16 tp)))
130141
| AL.Modify (AL.SetTCPDstPort tp) ->
131142
(Mod.tpDst, SetTpDst VInt.(get_int16 (Int16 tp)))
132143
end)
133144

134-
let from_group (inPort : Core.portId option) (group : AL.group) : Core.action list =
145+
let from_group (inPort : Core.portId option) (group : AL.group)
146+
: Core.action list =
135147
match group with
136148
| [] -> []
137149
| [par] -> Common.flatten_par inPort par
138-
| _ -> raise (SDN_Types.Unsupported "OpenFlow 1.0 does not support fast-failover")
150+
| _ ->
151+
raise (SDN_Types.Unsupported "OpenFlow 1.0 does not support fast-failover")
139152

140153
let from_timeout (timeout : AL.timeout) : Core.timeout =
141154
match timeout with
142155
| AL.Permanent -> Core.Permanent
143156
| AL.ExpiresAfter n -> Core.ExpiresAfter n
144157

145-
let from_flow (priority : int) (flow : AL.flow) : Core.flowMod =
158+
let from_flow (priority : int) (flow : AL.flow) : Core.flowMod =
146159
let open AL in
147160
match flow with
148161
| { pattern; action; cookie; idle_timeout; hard_timeout } ->

setup.ml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
(* setup.ml generated for the first time by OASIS v0.4.4 *)
22

33
(* OASIS_START *)
4-
(* DO NOT EDIT (digest: c29ff81687df0f140f39a12771705bc0) *)
4+
(* DO NOT EDIT (digest: 6f3af400228e9874f5623738e988b944) *)
55
(*
66
Regenerated by OASIS v0.4.4
77
Visit http://oasis.forge.ocamlcore.org for more information and
@@ -6825,7 +6825,7 @@ let setup_t =
68256825
alpha_features = [];
68266826
beta_features = [];
68276827
name = "openflow";
6828-
version = "0.6.0";
6828+
version = "0.6.2";
68296829
license =
68306830
OASISLicense.DEP5License
68316831
(OASISLicense.DEP5Unit
@@ -7256,7 +7256,7 @@ let setup_t =
72567256
oasis_fn = Some "_oasis";
72577257
oasis_version = "0.4.4";
72587258
oasis_digest =
7259-
Some "\231\164\164\015\002\229\r\186\184\025\214\238\202.\200\227";
7259+
Some "\030)\144\210=\236\153\165\014\251\028n\230\153\006z";
72607260
oasis_exec = None;
72617261
oasis_setup_args = [];
72627262
setup_update = false

0 commit comments

Comments
 (0)