Goby v2
network_header.proto
1 
2 import "dccl/option_extensions.proto";
3 import "dccl/arithmetic/protobuf/arithmetic_extensions.proto";
4 
5 package goby.acomms.protobuf;
6 
7 message NetworkHeader
8 {
9  option (dccl.msg).id = 0xF000;
10  option (dccl.msg).max_bytes = 8;
11  option (dccl.msg).codec_version = 3;
12 
13  enum Protocol
14  {
15  ICMP = 0x01;
16  UDP = 0x11;
17  SCTP = 0x84;
18  }
19  required Protocol protocol = 1;
20 
21  required uint32 srcdest_addr = 10 [
22  (dccl.field).codec = "dccl.arithmetic",
23  (dccl.field).(arithmetic).model =
24  "goby.acomms.NetworkHeader.AddrModel"
25  ];
26 
27  // if Protocol == UDP
28  message UDPHeader
29  {
30  repeated uint32 srcdest_port = 1 [
31  (dccl.field).codec = "dccl.arithmetic",
32  (dccl.field).max_repeat = 2,
33  (dccl.field).(arithmetic).model =
34  "goby.acomms.NetworkHeader.PortModel"
35  ];
36  }
37  required UDPHeader udp = 20;
38 
39  // if Protocol == ICMP
40  message ICMPHeader
41  {
42  // not yet supported
43  }
44  // if Protocol == SCTP
45  message SCTPHeader
46  {
47  // not yet supported
48  }
49 
50  // total length of packet, if not supported by link layer
51  // optional int32 total_length = 100;
52 }
53 
54 // the real IP header
55 message IPv4Header
56 {
57  option (dccl.msg).id = 0xF001;
58  option (dccl.msg).max_bytes = 60;
59  option (dccl.msg).codec_version = 3;
60 
61  // DCCL is little-endian - so multi-field bytes are written in "reverse"
62  // order
63 
64  // Internet Header Length (IHL) in 32-bit words
65  required uint32 ihl = 2 [(dccl.field).min = 0, (dccl.field).max = 15];
66  // Version, always 4 for IPv4
67  required uint32 version = 1 [(dccl.field).min = 0, (dccl.field).max = 15];
68 
69  // Explicit Congestion Notification (ECN)
70  required uint32 ecn = 4 [(dccl.field).min = 0, (dccl.field).max = 63];
71  // Differentiated Services Code Point (DSCP)
72  required uint32 dscp = 3 [(dccl.field).min = 0, (dccl.field).max = 3];
73 
74  required uint32 total_length = 5 [(dccl.field).codec = "net.short"];
75  required uint32 identification = 6 [(dccl.field).codec = "net.short"];
76 
77  message FlagsFragOffset
78  {
79  required bool dont_fragment = 1;
80  required bool more_fragments = 2;
81  required uint32 fragment_offset = 3;
82  }
83  required FlagsFragOffset flags_frag_offset = 7
84  [(dccl.field).codec = "ip.v4.flagsfragoffset"];
85 
86  required uint32 ttl = 8 [(dccl.field).min = 0, (dccl.field).max = 255];
87  required uint32 protocol = 9 [(dccl.field).min = 0, (dccl.field).max = 255];
88  required uint32 header_checksum = 10 [(dccl.field).codec = "net.short"];
89 
90  required string source_ip_address = 11
91  [(dccl.field).codec = "ip.v4.address"];
92  required string dest_ip_address = 12 [(dccl.field).codec = "ip.v4.address"];
93 }
94 
95 message UDPHeader
96 {
97  option (dccl.msg).id = 0xF002;
98  option (dccl.msg).max_bytes = 8;
99  option (dccl.msg).codec_version = 3;
100 
101  required uint32 source_port = 1 [(dccl.field).codec = "net.short"];
102  required uint32 dest_port = 2 [(dccl.field).codec = "net.short"];
103  required uint32 length = 3 [(dccl.field).codec = "net.short"];
104  required uint32 checksum = 4 [(dccl.field).codec = "net.short"];
105 }
106 
107 message ICMPHeader
108 {
109  option (dccl.msg).id = 0xF003;
110  option (dccl.msg).max_bytes = 8;
111  option (dccl.msg).codec_version = 3;
112 
113  required uint32 type = 1 [(dccl.field).min = 0, (dccl.field).max = 255];
114  required uint32 code = 2 [(dccl.field).min = 0, (dccl.field).max = 255];
115  required uint32 checksum = 3 [(dccl.field).codec = "net.short"];
116  required uint32 short1 = 4 [(dccl.field).codec = "net.short"];
117  required uint32 short2 = 5 [(dccl.field).codec = "net.short"];
118 }
119 
120 message IPGatewayICMPControl
121 {
122  enum MessageType
123  {
124  QUEUE_REPORT = 1;
125  }
126  required MessageType type = 1;
127  required string address = 2;
128 
129  message QueueReport
130  {
131  message SubQueue
132  {
133  required int32 dest = 1;
134  required int32 size = 2;
135  }
136  repeated SubQueue queue = 1;
137  }
138  optional QueueReport queue_report = 3;
139 }