Skip to content

Commit 3e89d7c

Browse files
authored
Merge pull request #87 from insa-unyte/development
Development
2 parents 74bcb67 + 2c798a2 commit 3e89d7c

29 files changed

+268
-465
lines changed

LICENSE

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
Copyright (c) 2020 Unyte Project members
2-
Authors Tom Sampic, Axel Rosensthiel, Alex Huang, Pierre Francois, Stéphane Frénot
2+
Authors Tom Sampic, Axel Rosensthiel, Alex Huang Feng, Pierre Francois, Stéphane Frénot
33
WIRED Team
44
Telecommunications Department
55
INSA Lyon
6-
contact: <pierre-francois@insa-lyon.fr>
6+
contact: <pierre-francois@insa-lyon.fr>;<alex.huang-feng@insa-lyon.fr>
77

88

99
Permission to use, copy, modify, and distribute this software for any
@@ -20,4 +20,4 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
2020

2121

2222
This code is an implementation of a collector for UDP-Notif messages as defined in
23-
draft-ietf-netconf-udp-notif-01
23+
draft-ietf-netconf-udp-notif-06

README.md

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# 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).
33

44
## Compiling and installing project
55
See [INSTALL](INSTALL.md)
@@ -10,7 +10,7 @@ The collector allows to read and parse UDP-notif protocol messages from a ip/por
1010

1111
The api is in `unyte_udp_collector.h`:
1212
- `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.
1414
- `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)...
1515
- `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.
1616
- `int unyte_udp_free_all(unyte_seg_met_t *seg)` from `unyte_udp_collector.h`: free all struct used on a message received.
@@ -62,10 +62,10 @@ int main()
6262
// TODO: Process the UDP-notif message here
6363
printf("unyte_udp_get_version: %u\n", unyte_udp_get_version(seg));
6464
printf("unyte_udp_get_space: %u\n", unyte_udp_get_space(seg));
65-
printf("unyte_udp_get_encoding_type: %u\n", unyte_udp_get_encoding_type(seg));
65+
printf("unyte_udp_get_media_type: %u\n", unyte_udp_get_media_type(seg));
6666
printf("unyte_udp_get_header_length: %u\n", unyte_udp_get_header_length(seg));
6767
printf("unyte_udp_get_message_length: %u\n", unyte_udp_get_message_length(seg));
68-
printf("unyte_udp_get_generator_id: %u\n", unyte_udp_get_generator_id(seg));
68+
printf("unyte_udp_get_observation_domain_id: %u\n", unyte_udp_get_observation_domain_id(seg));
6969
printf("unyte_udp_get_message_id: %u\n", unyte_udp_get_message_id(seg));
7070
printf("unyte_udp_get_src[family]: %u\n", unyte_udp_get_src(seg)->ss_family); // AF_INET for IPv4 or AF_INET6 for IPv6
7171
printf("unyte_udp_get_dest_addr[family]: %u\n", unyte_udp_get_dest_addr(seg)->ss_family); // AF_INET for IPv4 or AF_INET6 for IPv6
@@ -100,12 +100,12 @@ typedef struct unyte_segment_with_metadata
100100
} unyte_seg_met_t;
101101
```
102102
##### Getters for segments data
103-
- `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
106106
- `uint16_t unyte_udp_get_header_length(unyte_seg_met_t *message);` : length of the message header in octets
107107
- `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
109109
- `uint32_t unyte_udp_get_message_id(unyte_seg_met_t *message);` : message id of the message
110110
- `struct sockaddr_storage * unyte_udp_get_src(unyte_seg_met_t *message);` : source IP and port of the message. Could be IPv4 or IPv6.
111111
- `struct sockaddr_storage * unyte_udp_get_dest_addr(unyte_seg_met_t *message);` : collector address. Could be IPv4 or IPv6.
@@ -124,7 +124,7 @@ typedef struct
124124
uint monitoring_delay; // monitoring queue frequence in seconds. Default: 5 seconds
125125
} unyte_udp_options_t;
126126
```
127-
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.
128128

129129
##### Type of threads
130130
The threads types are defined in `monitoring_worker.h`:
@@ -155,7 +155,7 @@ Limitations of udp-pub-channel-05:
155155
- Same output `struct unyte_seg_met_t` is given to the user.
156156
- Flags from the protocol are not parsed.
157157
- 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).
159159
- Google protobuf is returned as RESERVED(0) encoding type.
160160

161161
### Usage of the sender
@@ -166,16 +166,16 @@ The message to send have the following structure:
166166
```c
167167
typedef struct unyte_message
168168
{
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
172172

173173
// 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
179179
} unyte_message_t;
180180
```
181181

@@ -212,8 +212,8 @@ int main()
212212
// UDP-notif
213213
message->version = 0;
214214
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;
217217
message->message_id = 2147483669;
218218
message->used_mtu = 200; // If set to 0, the default mtu set on options is used, else, this one is used
219219

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.5.2-git
1+
0.6.0-git

deprecated/2_makefile

Lines changed: 0 additions & 83 deletions
This file was deleted.

deprecated/mine_install.sh

Lines changed: 0 additions & 57 deletions
This file was deleted.

deprecated/uninstall.sh

Lines changed: 0 additions & 47 deletions
This file was deleted.

examples/client_interface_bind_socket.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,10 @@ int main(int argc, char *argv[])
4949

5050
// printf("unyte_udp_get_version: %u\n", unyte_udp_get_version(seg));
5151
// printf("unyte_udp_get_space: %u\n", unyte_udp_get_space(seg));
52-
// printf("unyte_udp_get_encoding_type: %u\n", unyte_udp_get_encoding_type(seg));
52+
// printf("unyte_udp_get_media_type: %u\n", unyte_udp_get_media_type(seg));
5353
// printf("unyte_udp_get_header_length: %u\n", unyte_udp_get_header_length(seg));
5454
// printf("unyte_udp_get_message_length: %u\n", unyte_udp_get_message_length(seg));
55-
// printf("unyte_udp_get_generator_id: %u\n", unyte_udp_get_generator_id(seg));
55+
// printf("unyte_udp_get_observation_domain_id: %u\n", unyte_udp_get_observation_domain_id(seg));
5656
// printf("unyte_udp_get_message_id: %u\n", unyte_udp_get_message_id(seg));
5757
// printf("unyte_udp_get_src[family]: %u\n", unyte_udp_get_src(seg)->ss_family);
5858
// printf("unyte_udp_get_dest_addr[family]: %u\n", unyte_udp_get_dest_addr(seg)->ss_family);

examples/client_legacy_proto.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,10 @@ int main(int argc, char *argv[])
4949

5050
printf("unyte_udp_get_version: %u\n", unyte_udp_get_version(seg));
5151
printf("unyte_udp_get_space: %u\n", unyte_udp_get_space(seg));
52-
printf("unyte_udp_get_encoding_type: %u\n", unyte_udp_get_encoding_type(seg));
52+
printf("unyte_udp_get_media_type: %u\n", unyte_udp_get_media_type(seg));
5353
printf("unyte_udp_get_header_length: %u\n", unyte_udp_get_header_length(seg));
5454
printf("unyte_udp_get_message_length: %u\n", unyte_udp_get_message_length(seg));
55-
printf("unyte_udp_get_generator_id: %u\n", unyte_udp_get_generator_id(seg));
55+
printf("unyte_udp_get_observation_domain_id: %u\n", unyte_udp_get_observation_domain_id(seg));
5656
printf("unyte_udp_get_message_id: %u\n", unyte_udp_get_message_id(seg));
5757
// printf("unyte_udp_get_src[family]: %u\n", unyte_udp_get_src(seg)->ss_family);
5858
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)

examples/client_monitoring.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ int main(int argc, char *argv[])
7676
// Getters
7777
// printf("Thread id: %ld\n", unyte_udp_get_thread_id(counter));
7878
// printf("Thread type: %d\n", unyte_udp_get_th_type(counter));
79-
// printf("Generator id: %d\n", unyte_udp_get_gen_id(counter));
79+
// printf("Observation domain id: %d\n", unyte_udp_get_od_id(counter));
8080
// printf("Last msg id: %d\n", unyte_udp_get_last_msg_id(counter));
8181
// printf("Received OK: %d\n", unyte_udp_get_received_seg(counter));
8282
// printf("Dropped: %d\n", unyte_udp_get_dropped_seg(counter));

examples/client_sample.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,10 @@ int main(int argc, char *argv[])
4848

4949
// printf("unyte_udp_get_version: %u\n", unyte_udp_get_version(seg));
5050
// printf("unyte_udp_get_space: %u\n", unyte_udp_get_space(seg));
51-
// printf("unyte_udp_get_encoding_type: %u\n", unyte_udp_get_encoding_type(seg));
51+
// printf("unyte_udp_get_media_type: %u\n", unyte_udp_get_media_type(seg));
5252
// printf("unyte_udp_get_header_length: %u\n", unyte_udp_get_header_length(seg));
5353
// printf("unyte_udp_get_message_length: %u\n", unyte_udp_get_message_length(seg));
54-
// printf("unyte_udp_get_generator_id: %u\n", unyte_udp_get_generator_id(seg));
54+
// printf("unyte_udp_get_observation_domain_id: %u\n", unyte_udp_get_observation_domain_id(seg));
5555
// printf("unyte_udp_get_message_id: %u\n", unyte_udp_get_message_id(seg));
5656
// printf("unyte_udp_get_src[family]: %u\n", unyte_udp_get_src(seg)->ss_family);
5757
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

Comments
 (0)