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
+70-53Lines changed: 70 additions & 53 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,8 +1,8 @@
1
1
# C-Collector for UDP-notif
2
-
Library for collecting UDP-notif protocol messages.
2
+
Library for collecting UDP-notif protocol messages defined in the IETF draft [draft-ietf-netconf-udp-notif-01](https://tools.ietf.org/html/draft-ietf-netconf-udp-notif-01).
3
3
4
4
## Build & install
5
-
To build the project and test example clients, just `make` on root folder. Il will compile with gcc all dependences and the clients.
5
+
To build the project and test example clients, just `make` on root folder. Il will compile with gcc all dependencies and the clients.
6
6
7
7
### Installing
8
8
To install the library on a machine, run `make install` with sudo and `export.sh` without sudo. Export script will export the LD_LIBRARY_PATH on user space.
@@ -14,20 +14,20 @@ $ ./export.sh
14
14
15
15
### Uninstalling
16
16
```
17
-
$ sudo ./uninstall.sh
17
+
$ sudo make uninstall
18
18
```
19
19
You should remove the export of the lib in your bashrc manually yourself to fully remove the lib.
20
20
21
21
## Usage
22
22
### Usage of the UDP-notif collector
23
23
The collector allows to read and parse UDP-notif protocol messages from a ip/port specified on the parameters. It allows to get directly the buffer and the metadata of the message in a struct.
24
24
25
-
The api is in `unyte_collector.h` :
26
-
-`unyte_collector_t *unyte_start_collector(unyte_options_t *options)` from `unyte_collector.h`: Initialize the UDP-notif messages collector. It accepts a struct with different options: address (the IP address to listen to), port (port to listen to), recvmmsg_vlen (vlen used on recvmmsg syscall meaning how many messages to receive on every syscall, by default 10)
27
-
-`void *unyte_queue_read(queue_t *queue)` from `queue.h` : read from a queue a struct with all the message buffer and metadata.
28
-
-`int unyte_free_all(unyte_seg_met_t *seg)` from `unyte_collector.h`: free all struct used on a message received.
25
+
The api is in `unyte_udp_collector.h` :
26
+
-`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: address (the IP address to listen to), port (port to listen to), recvmmsg_vlen (vlen used on recvmmsg syscall meaning how many messages to receive on every syscall, by default 10)
27
+
-`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.
28
+
-`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 get_version(unyte_seg_met_t *message);` : encoding version
121
-
-`uint8_t get_space(unyte_seg_met_t *message);` : space of encoding version
122
-
-`uint8_t get_encoding_type(unyte_seg_met_t *message);` : dentifier to indicate the encoding type used for the Notification Message
123
-
-`uint16_t get_header_length(unyte_seg_met_t *message);` : length of the message header in octets
124
-
-`uint16_t get_message_length(unyte_seg_met_t *message);` : total length of the message within one UDP datagram, measured in octets, including the message header
125
-
-`uint32_t get_generator_id(unyte_seg_met_t *message);` : observation domain id of the message
126
-
-`uint32_t get_message_id(unyte_seg_met_t *message);` : message id of the message
127
-
-`uint16_t get_src_port(unyte_seg_met_t *message);` : source port of the message
128
-
-`uint32_t get_src_addr(unyte_seg_met_t *message);` : source address of the message
-`uint8_t unyte_udp_get_version(unyte_seg_met_t *message);` : encoding version
113
+
-`uint8_t unyte_udp_get_space(unyte_seg_met_t *message);` : space of encoding version
114
+
-`uint8_t unyte_udp_get_encoding_type(unyte_seg_met_t *message);` : dentifier to indicate the encoding type used for the Notification Message
115
+
-`uint16_t unyte_udp_get_header_length(unyte_seg_met_t *message);` : length of the message header in octets
116
+
-`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
117
+
-`uint32_t unyte_udp_get_generator_id(unyte_seg_met_t *message);` : observation domain id of the message
118
+
-`uint32_t unyte_udp_get_message_id(unyte_seg_met_t *message);` : message id of the message
119
+
-`uint16_t unyte_udp_get_src_port(unyte_seg_met_t *message);` : source port of the message
120
+
-`uint32_t unyte_udp_get_src_addr(unyte_seg_met_t *message);` : source address of the message
The thread will every `monitoring_delay` seconds send all generators id's counters.
139
+
140
+
##### Type of threads
141
+
The threads types are defined in `monitoring_worker.h`:
142
+
-`PARSER_WORKER`: worker in charge of parsing the segments. Reassembles or saves in memory the segmented messages.
143
+
-`LISTENER_WORKER`: worker in charge of receiving the bytes from the socket. It calls `recvmmsg()` syscall to receive multiple messages at once.
144
+
145
+
##### Packets loss
146
+
Two usecases are possible monitoring packets loss:
147
+
- Drops on `PARSER_WORKER`: It means the client consuming the parsed messages is not consuming that fast. You may want to multithread the client consuming the `collector->queue` (output_queue) or increase the `output_queue_size` option to avoid packets drops on spikes.
148
+
- Drops on `LISTENER_WORKER`: It means the `N` parsers are not consuming that fast and the `LISTENER_WORKER` is pushing to the `input_queue` faster than the parsers could read. You may want to increment the number of parsers instantiated or increase `parsers_queue_size` option to avoid packets drops on spikes.
132
149
133
150
### Usage of the sender
134
151
The sender allows the user to send UDP-notif protocol to a IP/port specified. It cuts the message into segments of the protocol if it is larger than the MTU specified in parameters.
0 commit comments