reactor-c
C Runtime for Lingua Franca
Loading...
Searching...
No Matches
net_common.h
Go to the documentation of this file.
1
179#ifndef NET_COMMON_H
180#define NET_COMMON_H
181
187#define FED_COM_BUFFER_SIZE 256u
188
195#define ADDRESS_QUERY_RETRY_INTERVAL MSEC(250)
196
206#define DELAY_START SEC(1)
207
210
211// These message types will be encoded in an unsigned char,
212// so the magnitude must not exceed 255. Note that these are
213// listed in increasing numerical order starting from 0 interleaved
214// with decreasing numerical order starting from 255 (so that they
215// can be listed in a logical order here even as the design evolves).
216
222#define MSG_TYPE_REJECT 0
223
228#define MSG_TYPE_ACK 255
229
238#define MSG_TYPE_UDP_PORT 254
239
256#define MSG_TYPE_FED_IDS 1
257
259
269#define MSG_TYPE_FED_NONCE 100
270
283#define MSG_TYPE_RTI_RESPONSE 101
284
295#define MSG_TYPE_FED_RESPONSE 102
296
300#define NONCE_LENGTH 8
301
305#define SHA256_HMAC_LENGTH 32
306
313#define MSG_TYPE_TIMESTAMP 2
314#define MSG_TYPE_TIMESTAMP_LENGTH (1 + sizeof(int64_t))
315
325#define MSG_TYPE_MESSAGE 3
326
330#define MSG_TYPE_RESIGN 4
331
345#define MSG_TYPE_TAGGED_MESSAGE 5
346
361#define MSG_TYPE_NEXT_EVENT_TAG 6
362
371#define MSG_TYPE_TAG_ADVANCE_GRANT 7
372
381#define MSG_TYPE_PROVISIONAL_TAG_ADVANCE_GRANT 8
382
389#define MSG_TYPE_LATEST_TAG_CONFIRMED 9
390
406
427#define MSG_TYPE_STOP_REQUEST 10
428#define MSG_TYPE_STOP_REQUEST_LENGTH (1 + sizeof(instant_t) + sizeof(microstep_t))
429#define ENCODE_STOP_REQUEST(buffer, time, microstep) \
430 do { \
431 buffer[0] = MSG_TYPE_STOP_REQUEST; \
432 encode_int64(time, &(buffer[1])); \
433 encode_int32((int32_t)microstep, &(buffer[1 + sizeof(instant_t)])); \
434 } while (0)
435
444#define MSG_TYPE_STOP_REQUEST_REPLY 11
445#define MSG_TYPE_STOP_REQUEST_REPLY_LENGTH (1 + sizeof(instant_t) + sizeof(microstep_t))
446#define ENCODE_STOP_REQUEST_REPLY(buffer, time, microstep) \
447 do { \
448 buffer[0] = MSG_TYPE_STOP_REQUEST_REPLY; \
449 encode_int64(time, &(buffer[1])); \
450 encode_int32((int32_t)microstep, &(buffer[1 + sizeof(instant_t)])); \
451 } while (0)
452
460#define MSG_TYPE_STOP_GRANTED 12
461#define MSG_TYPE_STOP_GRANTED_LENGTH (1 + sizeof(instant_t) + sizeof(microstep_t))
462#define ENCODE_STOP_GRANTED(buffer, time, microstep) \
463 do { \
464 buffer[0] = MSG_TYPE_STOP_GRANTED; \
465 encode_int64(time, &(buffer[1])); \
466 encode_int32((int32_t)microstep, &(buffer[1 + sizeof(instant_t)])); \
467 } while (0)
468
470
476#define MSG_TYPE_ADDRESS_QUERY 13
477
488#define MSG_TYPE_ADDRESS_QUERY_REPLY 14
489
498#define MSG_TYPE_ADDRESS_ADVERTISEMENT 15
499
509#define MSG_TYPE_P2P_SENDING_FED_ID 16
510
520#define MSG_TYPE_P2P_MESSAGE 17
521
537#define MSG_TYPE_P2P_TAGGED_MESSAGE 18
538
540
544/*
545 * The next 8 bytes will be a timestamp sent according to
546 * PTP.
547 */
548#define MSG_TYPE_CLOCK_SYNC_T1 19
549
550/*
551 * Prompts the master to send a T4.
552 * The next four bytes will be the sendin federate's id
553 */
554#define MSG_TYPE_CLOCK_SYNC_T3 20
555
556/*
557 * The next 8 bytes will be a timestamp sent according to
558 * PTP.
559 */
560#define MSG_TYPE_CLOCK_SYNC_T4 21
561
572#define MSG_TYPE_CLOCK_SYNC_CODED_PROBE 22
573
585#define MSG_TYPE_PORT_ABSENT 23
586
612#define MSG_TYPE_NEIGHBOR_STRUCTURE 24
613#define MSG_TYPE_NEIGHBOR_STRUCTURE_HEADER_SIZE 9
614
618#define MSG_TYPE_FAILED 25
619
622
629#define FEDERATION_ID_DOES_NOT_MATCH 1
630
632#define FEDERATE_ID_IN_USE 2
633
635#define FEDERATE_ID_OUT_OF_RANGE 3
636
638#define UNEXPECTED_MESSAGE 4
639
641#define WRONG_SERVER 5
642
644#define HMAC_DOES_NOT_MATCH 6
645
647#define RTI_NOT_EXECUTED_WITH_AUTH 7
648
649#endif /* NET_COMMON_H */