Scripts placed on scripts directory
[vsorcdistro/.git] / ryu / ryu / tests / packet_data_generator / src / x_of_protocol.erl
1 %% Copyright (C) 2013 Nippon Telegraph and Telephone Corporation.
2 %% Copyright (C) 2013 YAMAMOTO Takashi <yamamoto at valinux co jp>
3 %%
4 %% Licensed under the Apache License, Version 2.0 (the "License");
5 %% you may not use this file except in compliance with the License.
6 %% You may obtain a copy of the License at
7 %%
8 %%    http://www.apache.org/licenses/LICENSE-2.0
9 %%
10 %% Unless required by applicable law or agreed to in writing, software
11 %% distributed under the License is distributed on an "AS IS" BASIS,
12 %% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
13 %% implied.
14 %% See the License for the specific language governing permissions and
15 %% limitations under the License.
16
17 -module(x_of_protocol).
18 -export([message/3, message_extract/1, encode/1, decode/1]).
19
20 -include_lib("of_protocol/include/of_protocol.hrl").
21
22 message(OFPVersion, Xid, Body) ->
23     #ofp_message{version=OFPVersion, xid=Xid, body=Body}.
24
25 message_extract(Msg) ->
26     #ofp_message{version=OFPVersion, xid=Xid, body=Body} = Msg,
27     {OFPVersion, Xid, Body}.
28
29 encode(Msg) ->
30     of_protocol:encode(Msg).
31
32 decode(BinMsg) ->
33     of_protocol:decode(BinMsg).