You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+20-20Lines changed: 20 additions & 20 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
# C-Collector for UDP-notif
2
-
Library for collecting UDP-notif protocol messages defined in the IETF draft [draft-ietf-netconf-udp-notif-04](https://datatracker.ietf.org/doc/html/draft-ietf-netconf-udp-notif-04).
2
+
Library for collecting UDP-notif protocol messages defined in the IETF draft [draft-ietf-netconf-udp-notif-06](https://datatracker.ietf.org/doc/html/draft-ietf-netconf-udp-notif-06).
3
3
4
4
## Compiling and installing project
5
5
See [INSTALL](INSTALL.md)
@@ -10,7 +10,7 @@ The collector allows to read and parse UDP-notif protocol messages from a ip/por
10
10
11
11
The api is in `unyte_udp_collector.h`:
12
12
-`int unyte_udp_create_socket(char *address, char *port, uint64_t buffer_size)` from `unyte_udp_utils.h`: Helper that creates and binds a socket to an address and port.
13
-
-`int unyte_udp_create_interface_bound_socket(char *interface, char *address, char *port, uint64_t buffer_size)` from `unyte_udp_utils.h`: Helper that creates a socket, binds it to an interface using SO_BINDTODEVICE option and binds it to an adress and port.
13
+
-`int unyte_udp_create_interface_bound_socket(char *interface, char *address, char *port, uint64_t buffer_size)` from `unyte_udp_utils.h`: Helper that creates a socket, binds it to an interface using SO_BINDTODEVICE option and binds it to an address and port.
14
14
-`unyte_udp_collector_t *unyte_udp_start_collector(unyte_udp_options_t *options)` from `unyte_udp_collector.h`: Initialize the UDP-notif messages collector. It accepts a struct with different options: socketfd of the socket to listen to, recvmmsg_vlen (vlen used on recvmmsg syscall meaning how many messages to receive on every syscall, by default 10)...
15
15
-`void *unyte_udp_queue_read(unyte_udp_queue_t *queue)` from `unyte_udp_queue.h` : read from a queue a struct with all the message buffer and metadata.
16
16
-`int unyte_udp_free_all(unyte_seg_met_t *seg)` from `unyte_udp_collector.h`: free all struct used on a message received.
-`uint8_t unyte_udp_get_version(unyte_seg_met_t *message);` : encoding version
104
-
-`uint8_t unyte_udp_get_space(unyte_seg_met_t *message);` : space of encoding version
105
-
-`uint8_t unyte_udp_get_encoding_type(unyte_seg_met_t *message);` : dentifier to indicate the encoding type used for the Notification Message
103
+
-`uint8_t unyte_udp_get_version(unyte_seg_met_t *message);` : header encoding version
104
+
-`uint8_t unyte_udp_get_space(unyte_seg_met_t *message);` : space of media type version
105
+
-`uint8_t unyte_udp_get_media_type(unyte_seg_met_t *message);` : dentifier to indicate the media type used for the Notification Message
106
106
-`uint16_t unyte_udp_get_header_length(unyte_seg_met_t *message);` : length of the message header in octets
107
107
-`uint16_t unyte_udp_get_message_length(unyte_seg_met_t *message);` : total length of the message within one UDP datagram, measured in octets, including the message header
108
-
-`uint32_t unyte_udp_get_generator_id(unyte_seg_met_t *message);` : observation domain id of the message
108
+
-`uint32_t unyte_udp_get_observation_domain_id(unyte_seg_met_t *message);` : observation domain id of the message
109
109
-`uint32_t unyte_udp_get_message_id(unyte_seg_met_t *message);` : message id of the message
110
110
-`struct sockaddr_storage * unyte_udp_get_src(unyte_seg_met_t *message);` : source IP and port of the message. Could be IPv4 or IPv6.
111
111
-`struct sockaddr_storage * unyte_udp_get_dest_addr(unyte_seg_met_t *message);` : collector address. Could be IPv4 or IPv6.
The thread will every `monitoring_delay` seconds send all generators id's counters.
127
+
The thread will every `monitoring_delay` seconds send all observation domain id's counters.
128
128
129
129
##### Type of threads
130
130
The threads types are defined in `monitoring_worker.h`:
@@ -155,7 +155,7 @@ Limitations of udp-pub-channel-05:
155
155
- Same output `struct unyte_seg_met_t` is given to the user.
156
156
- Flags from the protocol are not parsed.
157
157
- No options are possible and thus no segmentation is supported
158
-
- The encoding type identifiers are taken from the IANA instead of the draft to maintain consistency in the different pipelines. IANA codes could be checked in the main [draft](https://datatracker.ietf.org/doc/html/draft-ietf-netconf-udp-notif-04#section-9).
158
+
- The media type identifiers are taken from the IANA instead of the draft to maintain consistency in the different pipelines. IANA codes could be checked in the main [draft](https://datatracker.ietf.org/doc/html/draft-ietf-netconf-udp-notif-04#section-9).
159
159
- Google protobuf is returned as RESERVED(0) encoding type.
160
160
161
161
### Usage of the sender
@@ -166,16 +166,16 @@ The message to send have the following structure:
166
166
```c
167
167
typedefstruct unyte_message
168
168
{
169
-
uint used_mtu; // MTU to use for cutting the message to segments
170
-
void *buffer; // pointer to buffer to send
171
-
uint buffer_len; // length of the buffer to send
169
+
uint used_mtu; // MTU to use for cutting the message to segments
170
+
void *buffer; // pointer to buffer to send
171
+
uint buffer_len; // length of the buffer to send
172
172
173
173
// UDP-notif
174
-
uint8_t version : 3; // UDP-notif protocol version
175
-
uint8_t space : 1; // UDP-notif protocol space
176
-
uint8_t encoding_type : 4; // UDP-notif protocol encoding type
177
-
uint32_t generator_id; // UDP-notif protocol observation domain id
178
-
uint32_t message_id; // UDP-notif protocol message id
174
+
uint8_t version : 3; // UDP-notif protocol version
175
+
uint8_t space : 1; // UDP-notif protocol space
176
+
uint8_t media_type : 4; // UDP-notif protocol media type
177
+
uint32_t observation_domain_id; // UDP-notif protocol observation domain id
178
+
uint32_t message_id; // UDP-notif protocol message id
179
179
} unyte_message_t;
180
180
```
181
181
@@ -212,8 +212,8 @@ int main()
212
212
// UDP-notif
213
213
message->version = 0;
214
214
message->space = 0;
215
-
message->encoding_type = UNYTE_ENCODING_JSON; // json but sending string
216
-
message->generator_id = 1000;
215
+
message->media_type = UNYTE_MEDIATYPE_YANG_JSON; // json but sending string
216
+
message->observation_domain_id = 1000;
217
217
message->message_id = 2147483669;
218
218
message->used_mtu = 200; // If set to 0, the default mtu set on options is used, else, this one is used
printf("unyte_udp_get_dest_addr[family]: %u\n", unyte_udp_get_dest_addr(seg) ==NULL ? 0 : unyte_udp_get_dest_addr(seg)->ss_family); // NULL if options.msg_dst_ip is set to false (default)
printf("unyte_udp_get_dest_addr[family]: %u\n", unyte_udp_get_dest_addr(seg) ==NULL ? 0 : unyte_udp_get_dest_addr(seg)->ss_family); // NULL if options.msg_dst_ip is set to false (default)
0 commit comments