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
186
#define TCP_TIMEOUT_TIME SEC(10)
187
192
#define UDP_TIMEOUT_TIME SEC(1)
193
199
#define FED_COM_BUFFER_SIZE 256u
200
204
#define CONNECT_RETRY_INTERVAL MSEC(500)
205
211
#define CONNECT_TIMEOUT MINUTES(1)
212
218
#define MAX_NUM_PORT_ADDRESSES 16
219
226
#define ADDRESS_QUERY_RETRY_INTERVAL MSEC(250)
227
235
#define PORT_BIND_RETRY_INTERVAL SEC(1)
236
240
#define PORT_BIND_RETRY_LIMIT 60
241
248
#define DEFAULT_PORT 15045u
249
259
#define DELAY_START SEC(1)
260
263
264
// These message types will be encoded in an unsigned char,
265
// so the magnitude must not exceed 255. Note that these are
266
// listed in increasing numerical order starting from 0 interleaved
267
// with decreasing numerical order starting from 255 (so that they
268
// can be listed in a logical order here even as the design evolves).
269
275
#define MSG_TYPE_REJECT 0
276
281
#define MSG_TYPE_ACK 255
282
291
#define MSG_TYPE_UDP_PORT 254
292
309
#define MSG_TYPE_FED_IDS 1
310
312
322
#define MSG_TYPE_FED_NONCE 100
323
336
#define MSG_TYPE_RTI_RESPONSE 101
337
348
#define MSG_TYPE_FED_RESPONSE 102
349
353
#define NONCE_LENGTH 8
354
358
#define SHA256_HMAC_LENGTH 32
359
366
#define MSG_TYPE_TIMESTAMP 2
367
#define MSG_TYPE_TIMESTAMP_LENGTH (1 + sizeof(int64_t))
368
378
#define MSG_TYPE_MESSAGE 3
379
383
#define MSG_TYPE_RESIGN 4
384
398
#define MSG_TYPE_TAGGED_MESSAGE 5
399
414
#define MSG_TYPE_NEXT_EVENT_TAG 6
415
424
#define MSG_TYPE_TAG_ADVANCE_GRANT 7
425
434
#define MSG_TYPE_PROVISIONAL_TAG_ADVANCE_GRANT 8
435
442
#define MSG_TYPE_LATEST_TAG_CONFIRMED 9
443
459
480
#define MSG_TYPE_STOP_REQUEST 10
481
#define MSG_TYPE_STOP_REQUEST_LENGTH (1 + sizeof(instant_t) + sizeof(microstep_t))
482
#define ENCODE_STOP_REQUEST(buffer, time, microstep) \
483
do { \
484
buffer[0] = MSG_TYPE_STOP_REQUEST; \
485
encode_int64(time, &(buffer[1])); \
486
encode_int32((int32_t)microstep, &(buffer[1 + sizeof(instant_t)])); \
487
} while (0)
488
497
#define MSG_TYPE_STOP_REQUEST_REPLY 11
498
#define MSG_TYPE_STOP_REQUEST_REPLY_LENGTH (1 + sizeof(instant_t) + sizeof(microstep_t))
499
#define ENCODE_STOP_REQUEST_REPLY(buffer, time, microstep) \
500
do { \
501
buffer[0] = MSG_TYPE_STOP_REQUEST_REPLY; \
502
encode_int64(time, &(buffer[1])); \
503
encode_int32((int32_t)microstep, &(buffer[1 + sizeof(instant_t)])); \
504
} while (0)
505
513
#define MSG_TYPE_STOP_GRANTED 12
514
#define MSG_TYPE_STOP_GRANTED_LENGTH (1 + sizeof(instant_t) + sizeof(microstep_t))
515
#define ENCODE_STOP_GRANTED(buffer, time, microstep) \
516
do { \
517
buffer[0] = MSG_TYPE_STOP_GRANTED; \
518
encode_int64(time, &(buffer[1])); \
519
encode_int32((int32_t)microstep, &(buffer[1 + sizeof(instant_t)])); \
520
} while (0)
521
523
529
#define MSG_TYPE_ADDRESS_QUERY 13
530
541
#define MSG_TYPE_ADDRESS_QUERY_REPLY 14
542
551
#define MSG_TYPE_ADDRESS_ADVERTISEMENT 15
552
562
#define MSG_TYPE_P2P_SENDING_FED_ID 16
563
573
#define MSG_TYPE_P2P_MESSAGE 17
574
590
#define MSG_TYPE_P2P_TAGGED_MESSAGE 18
591
593
597
/*
598
* The next 8 bytes will be a timestamp sent according to
599
* PTP.
600
*/
601
#define MSG_TYPE_CLOCK_SYNC_T1 19
602
603
/*
604
* Prompts the master to send a T4.
605
* The next four bytes will be the sendin federate's id
606
*/
607
#define MSG_TYPE_CLOCK_SYNC_T3 20
608
609
/*
610
* The next 8 bytes will be a timestamp sent according to
611
* PTP.
612
*/
613
#define MSG_TYPE_CLOCK_SYNC_T4 21
614
625
#define MSG_TYPE_CLOCK_SYNC_CODED_PROBE 22
626
638
#define MSG_TYPE_PORT_ABSENT 23
639
665
#define MSG_TYPE_NEIGHBOR_STRUCTURE 24
666
#define MSG_TYPE_NEIGHBOR_STRUCTURE_HEADER_SIZE 9
667
671
#define MSG_TYPE_FAILED 25
672
675
682
#define FEDERATION_ID_DOES_NOT_MATCH 1
683
685
#define FEDERATE_ID_IN_USE 2
686
688
#define FEDERATE_ID_OUT_OF_RANGE 3
689
691
#define UNEXPECTED_MESSAGE 4
692
694
#define WRONG_SERVER 5
695
697
#define HMAC_DOES_NOT_MATCH 6
698
700
#define RTI_NOT_EXECUTED_WITH_AUTH 7
701
702
#endif
/* NET_COMMON_H */
include
core
federated
network
net_common.h
Generated by
1.12.0