Mercurial > cgi-bin > hgwebdir.cgi > VMS > C_Libraries > BestEffortMessaging
comparison LossyCom.h @ 5:95a03e431480
corrected comments and variable renaming
| author | Merten Sach <msach@mailbox.tu-berlin.de> |
|---|---|
| date | Tue, 13 Mar 2012 19:07:49 +0100 |
| parents | 7ba5a3a6102d |
| children |
comparison
equal
deleted
inserted
replaced
| 4:48a3d6cb24a8 | 5:f3bc1b83cd5a |
|---|---|
| 2 * This describes a best effort communication channel. Mainly designed for | 2 * This describes a best effort communication channel. Mainly designed for |
| 3 * communication between Core-Controllers, so they can inform each other about | 3 * communication between Core-Controllers, so they can inform each other about |
| 4 * their status and pass work around. This is to avoid idling cores that occupy | 4 * their status and pass work around. This is to avoid idling cores that occupy |
| 5 * the Masterlock. | 5 * the Masterlock. |
| 6 * | 6 * |
| 7 * The communication entities poll a central trigger counter that increases when | 7 * The communication entities poll a central trigger counter and per receiver |
| 8 * there are new messages. However it's not guaranteed that the increase of the | 8 * trigger counter that increase when there are new messages. |
| 9 * counter reflects the number of new messages. | 9 * However it's not guaranteed that the increase of the counter reflects the |
| 10 * number of new messages. The new trigger counter can even be lower than the | |
| 11 * last see counter for some receiver. | |
| 10 * | 12 * |
| 11 * The messages consist of a single 64bit word so it can be written in one | 13 * The messages consist of a single 64bit word so it can be written in one |
| 12 * operation and therefore avoiding inconsistent messages. | 14 * operation and therefore avoiding inconsistent messages. |
| 13 * | 15 * |
| 14 * The messages are handled with a handler function provided by the receiver | 16 * The messages are handled with a handler function provided by the receiver |
| 15 * when acquiring the communication endpoint. | 17 * when acquiring the communication endpoint. |
| 16 * | 18 * |
| 17 * The message passing is handled by a central struct that is used w/o any lock. | 19 * The message passing is handled by a central struct that is used w/o any lock. |
| 18 * It consists of a array messages for the number of communicating entities. The | 20 * It consists of a array messages for the number of communicating endpoints. |
| 19 * number of entities is fixed at initialization. | 21 * The number of endpoints is fixed at initialization time. |
| 20 */ | 22 */ |
| 23 | |
| 24 #ifndef LOSSYCOM_H | |
| 25 #define LOSSYCOM_H | |
| 21 | 26 |
| 22 #include <stdint.h> | 27 #include <stdint.h> |
| 23 | 28 |
| 24 /*********************************** | 29 /*********************************** |
| 25 * General Defines | 30 * General Defines |
| 56 | 61 |
| 57 /* | 62 /* |
| 58 * Central communication structure. | 63 * Central communication structure. |
| 59 */ | 64 */ |
| 60 typedef struct{ | 65 typedef struct{ |
| 61 volatile uint16_t BroadcastTriggerCounter; | 66 volatile uint16_t broadcastTriggerCounter; |
| 62 volatile uint16_t* p2pTriggerCounter; | 67 volatile uint16_t* p2pTriggerCounters; |
| 63 uint16_t numEndpoints; | 68 uint16_t numEndpoints; |
| 64 lossyCom__msg_t* outboxArray; | 69 lossyCom__msg_t* outboxArray; |
| 65 }lossyCom__exchange_t; | 70 }lossyCom__exchange_t; |
| 66 | 71 |
| 67 /* | 72 /* |
| 68 * Endpoint data structure. | 73 * Endpoint data structure. |
| 69 */ | 74 */ |
| 70 typedef struct { | 75 typedef struct { |
| 76 lossyCom__exchange_t* centralExchange; | |
| 77 lossyCom__endpointID_t endpointID; | |
| 78 lossyCom__msgHandler msgHandler; | |
| 79 void* msgHandlerData; | |
| 71 uint16_t lastReceivedBroadcastTrigger; | 80 uint16_t lastReceivedBroadcastTrigger; |
| 72 uint16_t lastReceivedp2pTrigger; | 81 uint16_t lastReceivedp2pTrigger; |
| 73 lossyCom__endpointID_t endpointID; | |
| 74 lossyCom__exchange_t* centralExchange; | |
| 75 lossyCom__msgHandler msgHandler; | |
| 76 void* msgHandlerData; | |
| 77 } lossyCom__endpoint_t; | 82 } lossyCom__endpoint_t; |
| 78 | 83 |
| 79 /*********************************** | 84 /*********************************** |
| 80 * Function Declarations | 85 * Function Declarations |
| 81 ***********************************/ | 86 ***********************************/ |
| 94 void lossyCom__sendMsg(lossyCom__endpoint_t* localEndpoint, | 99 void lossyCom__sendMsg(lossyCom__endpoint_t* localEndpoint, |
| 95 lossyCom__endpointID_t receiverEndpointID, | 100 lossyCom__endpointID_t receiverEndpointID, |
| 96 lossyCom__msgBody_t msg); | 101 lossyCom__msgBody_t msg); |
| 97 | 102 |
| 98 void lossyCom__receiveMsg(lossyCom__endpoint_t* localEndpoint); | 103 void lossyCom__receiveMsg(lossyCom__endpoint_t* localEndpoint); |
| 104 | |
| 105 #endif //LOSSYCOM_H |
