le_messaging.h
Go to the documentation of this file.
1 
795 #ifndef LE_MESSAGING_H_INCLUDE_GUARD
796 #define LE_MESSAGING_H_INCLUDE_GUARD
797 
798 // =======================================
799 // DATA TYPES
800 // =======================================
801 
802 //--------------------------------------------------------------------------------------------------
806 //--------------------------------------------------------------------------------------------------
807 typedef struct le_msg_Protocol* le_msg_ProtocolRef_t;
808 
809 //--------------------------------------------------------------------------------------------------
813 //--------------------------------------------------------------------------------------------------
814 typedef struct le_msg_Interface* le_msg_InterfaceRef_t;
815 
816 //--------------------------------------------------------------------------------------------------
820 //--------------------------------------------------------------------------------------------------
821 typedef struct le_msg_Service* le_msg_ServiceRef_t;
822 
823 //--------------------------------------------------------------------------------------------------
827 //--------------------------------------------------------------------------------------------------
828 typedef struct le_msg_ClientInterface* le_msg_ClientInterfaceRef_t;
829 
830 //--------------------------------------------------------------------------------------------------
834 //--------------------------------------------------------------------------------------------------
835 typedef struct le_msg_Session* le_msg_SessionRef_t;
836 
837 //--------------------------------------------------------------------------------------------------
841 //--------------------------------------------------------------------------------------------------
842 typedef struct le_msg_Message* le_msg_MessageRef_t;
843 
844 //--------------------------------------------------------------------------------------------------
849 //--------------------------------------------------------------------------------------------------
850 typedef struct le_msg_SessionEventHandler* le_msg_SessionEventHandlerRef_t;
851 
852 //--------------------------------------------------------------------------------------------------
863 //--------------------------------------------------------------------------------------------------
864 typedef void (* le_msg_SessionEventHandler_t)
865 (
866  le_msg_SessionRef_t sessionRef,
867  void* contextPtr
868 );
869 
870 
871 //--------------------------------------------------------------------------------------------------
882 //--------------------------------------------------------------------------------------------------
883 typedef void (* le_msg_ReceiveHandler_t)
884 (
885  le_msg_MessageRef_t msgRef,
886  void* contextPtr
887 );
888 
889 
890 //--------------------------------------------------------------------------------------------------
902 //--------------------------------------------------------------------------------------------------
903 typedef void (* le_msg_ResponseCallback_t)
904 (
905  le_msg_MessageRef_t msgRef,
906  void* contextPtr
907 );
908 
909 
910 // =======================================
911 // PROTOCOL FUNCTIONS
912 // =======================================
913 
914 //--------------------------------------------------------------------------------------------------
920 //--------------------------------------------------------------------------------------------------
922 (
923  const char* protocolId,
924  size_t largestMsgSize
925 );
926 
927 
928 //--------------------------------------------------------------------------------------------------
934 //--------------------------------------------------------------------------------------------------
935 const char* le_msg_GetProtocolIdStr
936 (
937  le_msg_ProtocolRef_t protocolRef
938 );
939 
940 
941 //--------------------------------------------------------------------------------------------------
947 //--------------------------------------------------------------------------------------------------
949 (
950  le_msg_ProtocolRef_t protocolRef
951 );
952 
953 
954 // =======================================
955 // SESSION FUNCTIONS
956 // =======================================
957 
958 //--------------------------------------------------------------------------------------------------
969 //--------------------------------------------------------------------------------------------------
971 (
972  le_msg_ProtocolRef_t protocolRef,
973  const char* interfaceName
974 );
975 
976 
977 //--------------------------------------------------------------------------------------------------
982 //--------------------------------------------------------------------------------------------------
984 (
985  le_msg_SessionRef_t sessionRef,
986 
987  void* contextPtr
988 );
990 
991 //--------------------------------------------------------------------------------------------------
999 //--------------------------------------------------------------------------------------------------
1001 (
1002  le_msg_SessionRef_t sessionRef
1003 );
1004 
1005 
1006 //--------------------------------------------------------------------------------------------------
1015 //--------------------------------------------------------------------------------------------------
1017 (
1018  le_msg_SessionRef_t sessionRef
1019 );
1020 
1021 
1022 //--------------------------------------------------------------------------------------------------
1033 //--------------------------------------------------------------------------------------------------
1035 (
1036  le_msg_SessionRef_t sessionRef,
1037  le_msg_ReceiveHandler_t handlerFunc,
1038  void* contextPtr
1039 );
1040 
1041 
1042 //--------------------------------------------------------------------------------------------------
1057 //--------------------------------------------------------------------------------------------------
1059 (
1060  le_msg_SessionRef_t sessionRef,
1061  le_msg_SessionEventHandler_t handlerFunc,
1062  void* contextPtr
1063 );
1064 
1065 
1066 //--------------------------------------------------------------------------------------------------
1077 //--------------------------------------------------------------------------------------------------
1078 void le_msg_OpenSession
1079 (
1080  le_msg_SessionRef_t sessionRef,
1081  le_msg_SessionEventHandler_t callbackFunc,
1082  void* contextPtr
1084 );
1085 
1086 
1087 //--------------------------------------------------------------------------------------------------
1099 //--------------------------------------------------------------------------------------------------
1101 (
1102  le_msg_SessionRef_t sessionRef
1103 );
1104 
1105 
1106 //--------------------------------------------------------------------------------------------------
1131 //--------------------------------------------------------------------------------------------------
1133 (
1134  le_msg_SessionRef_t sessionRef
1135 );
1136 
1137 
1138 //--------------------------------------------------------------------------------------------------
1142 //--------------------------------------------------------------------------------------------------
1144 (
1145  le_msg_SessionRef_t sessionRef
1146 );
1147 
1148 
1149 //--------------------------------------------------------------------------------------------------
1155 //--------------------------------------------------------------------------------------------------
1157 (
1158  le_msg_SessionRef_t sessionRef
1159 );
1160 
1161 
1162 //--------------------------------------------------------------------------------------------------
1168 //--------------------------------------------------------------------------------------------------
1170 (
1171  le_msg_SessionRef_t sessionRef
1172 );
1173 
1174 //--------------------------------------------------------------------------------------------------
1183 //--------------------------------------------------------------------------------------------------
1185 (
1186  le_msg_SessionRef_t sessionRef,
1187  uid_t* userIdPtr
1188 );
1189 
1190 //--------------------------------------------------------------------------------------------------
1199 //--------------------------------------------------------------------------------------------------
1201 (
1202  le_msg_SessionRef_t sessionRef,
1203  pid_t* processIdPtr
1204 );
1205 
1206 //--------------------------------------------------------------------------------------------------
1215 //--------------------------------------------------------------------------------------------------
1217 (
1218  le_msg_SessionRef_t sessionRef,
1219  uid_t* userIdPtr,
1220  pid_t* processIdPtr
1221 );
1222 
1223 
1224 
1225 // =======================================
1226 // MESSAGE FUNCTIONS
1227 // =======================================
1228 
1229 //--------------------------------------------------------------------------------------------------
1240 //--------------------------------------------------------------------------------------------------
1242 (
1243  le_msg_SessionRef_t sessionRef
1244 );
1245 
1246 
1247 //--------------------------------------------------------------------------------------------------
1251 //--------------------------------------------------------------------------------------------------
1252 void le_msg_AddRef
1253 (
1254  le_msg_MessageRef_t msgRef
1255 );
1256 
1257 
1258 //--------------------------------------------------------------------------------------------------
1263 //--------------------------------------------------------------------------------------------------
1264 void le_msg_ReleaseMsg
1265 (
1266  le_msg_MessageRef_t msgRef
1267 );
1268 
1269 
1270 //--------------------------------------------------------------------------------------------------
1281 //--------------------------------------------------------------------------------------------------
1283 (
1284  le_msg_MessageRef_t msgRef
1285 );
1286 
1287 
1288 //--------------------------------------------------------------------------------------------------
1296 //--------------------------------------------------------------------------------------------------
1298 (
1299  le_msg_MessageRef_t msgRef
1300 );
1301 
1302 
1303 //--------------------------------------------------------------------------------------------------
1309 //--------------------------------------------------------------------------------------------------
1311 (
1312  le_msg_MessageRef_t msgRef
1313 );
1314 
1315 
1316 //--------------------------------------------------------------------------------------------------
1325 //--------------------------------------------------------------------------------------------------
1326 void le_msg_SetFd
1327 (
1328  le_msg_MessageRef_t msgRef,
1329  int fd
1330 );
1331 
1332 
1333 //--------------------------------------------------------------------------------------------------
1340 //--------------------------------------------------------------------------------------------------
1341 int le_msg_GetFd
1342 (
1343  le_msg_MessageRef_t msgRef
1344 );
1345 
1346 
1347 //--------------------------------------------------------------------------------------------------
1351 //--------------------------------------------------------------------------------------------------
1352 void le_msg_Send
1353 (
1354  le_msg_MessageRef_t msgRef
1355 );
1356 
1357 
1358 //--------------------------------------------------------------------------------------------------
1364 //--------------------------------------------------------------------------------------------------
1366 (
1367  le_msg_MessageRef_t msgRef
1368 );
1369 
1370 
1371 //--------------------------------------------------------------------------------------------------
1384 //--------------------------------------------------------------------------------------------------
1386 (
1387  le_msg_MessageRef_t msgRef,
1388  le_msg_ResponseCallback_t handlerFunc,
1389  void* contextPtr
1390 );
1391 
1392 
1393 //--------------------------------------------------------------------------------------------------
1420 //--------------------------------------------------------------------------------------------------
1422 (
1423  le_msg_MessageRef_t msgRef
1424 );
1425 
1426 
1427 //--------------------------------------------------------------------------------------------------
1439 //--------------------------------------------------------------------------------------------------
1440 void le_msg_Respond
1441 (
1442  le_msg_MessageRef_t msgRef
1443 );
1444 
1445 
1446 // =======================================
1447 // INTERFACE FUNCTIONS
1448 // =======================================
1449 
1450 //--------------------------------------------------------------------------------------------------
1456 //--------------------------------------------------------------------------------------------------
1458 (
1459  le_msg_ProtocolRef_t protocolRef,
1460  const char* interfaceName
1461 );
1462 
1463 
1464 //--------------------------------------------------------------------------------------------------
1470 //--------------------------------------------------------------------------------------------------
1472 (
1473  le_msg_ServiceRef_t serviceRef
1474 );
1475 
1476 //--------------------------------------------------------------------------------------------------
1482 //--------------------------------------------------------------------------------------------------
1484 (
1485  le_msg_ServiceRef_t serviceRef,
1486  le_msg_SessionEventHandler_t handlerFunc,
1487  void* contextPtr
1488 );
1489 
1490 //--------------------------------------------------------------------------------------------------
1497 //--------------------------------------------------------------------------------------------------
1499 (
1500  le_msg_ServiceRef_t serviceRef,
1501  le_msg_SessionEventHandler_t handlerFunc,
1502  void* contextPtr
1503 );
1504 
1505 //--------------------------------------------------------------------------------------------------
1512 //--------------------------------------------------------------------------------------------------
1514 (
1516 );
1518 
1519 //--------------------------------------------------------------------------------------------------
1526 //--------------------------------------------------------------------------------------------------
1528 (
1529  le_msg_ServiceRef_t serviceRef,
1530  le_msg_ReceiveHandler_t handlerFunc,
1531  void* contextPtr
1532 );
1533 
1534 
1535 //--------------------------------------------------------------------------------------------------
1542 //--------------------------------------------------------------------------------------------------
1544 (
1545  le_msg_ServiceRef_t serviceRef,
1546 
1547  void* contextPtr
1548 );
1550 
1551 
1552 //--------------------------------------------------------------------------------------------------
1562 //--------------------------------------------------------------------------------------------------
1564 (
1565  le_msg_ServiceRef_t serviceRef
1566 );
1567 
1568 
1569 //--------------------------------------------------------------------------------------------------
1575 //--------------------------------------------------------------------------------------------------
1577 (
1578  le_msg_ServiceRef_t serviceRef
1579 );
1580 
1581 
1582 //--------------------------------------------------------------------------------------------------
1589 //--------------------------------------------------------------------------------------------------
1590 void le_msg_HideService
1591 (
1592  le_msg_ServiceRef_t serviceRef
1593 );
1594 
1595 
1596 //--------------------------------------------------------------------------------------------------
1604 //--------------------------------------------------------------------------------------------------
1605 const char* le_msg_GetInterfaceName
1606 (
1607  le_msg_InterfaceRef_t interfaceRef
1608 );
1609 
1610 
1611 //--------------------------------------------------------------------------------------------------
1617 //--------------------------------------------------------------------------------------------------
1619 (
1620  le_msg_InterfaceRef_t interfaceRef
1621 );
1622 
1623 
1624 //--------------------------------------------------------------------------------------------------
1632 //--------------------------------------------------------------------------------------------------
1634 (
1635  void
1636 );
1637 
1638 
1639 //--------------------------------------------------------------------------------------------------
1646 //--------------------------------------------------------------------------------------------------
1647 #define LE_KILL_CLIENT(formatString, ...) \
1648 { \
1649  le_msg_MessageRef_t msgRef = le_msg_GetServiceRxMsg(); \
1650  LE_FATAL_IF(msgRef == NULL, formatString, ##__VA_ARGS__); \
1651  LE_EMERG(formatString, ##__VA_ARGS__); \
1652  le_msg_CloseSession(le_msg_GetSession(msgRef)); \
1653 }
1654 
1655 #endif // LEGATO_MESSAGING_INCLUDE_GUARD
le_msg_MessageRef_t le_msg_GetServiceRxMsg(void)
void le_msg_AddRef(le_msg_MessageRef_t msgRef)
le_msg_ProtocolRef_t le_msg_GetProtocolRef(const char *protocolId, size_t largestMsgSize)
bool le_msg_NeedsResponse(le_msg_MessageRef_t msgRef)
size_t le_msg_GetProtocolMaxMsgSize(le_msg_ProtocolRef_t protocolRef)
void le_msg_ReleaseMsg(le_msg_MessageRef_t msgRef)
le_result_t le_msg_GetClientUserCreds(le_msg_SessionRef_t sessionRef, uid_t *userIdPtr, pid_t *processIdPtr)
le_result_t
Definition: le_basics.h:35
void * le_msg_GetServiceContextPtr(le_msg_ServiceRef_t serviceRef)
void le_msg_SetServiceRecvHandler(le_msg_ServiceRef_t serviceRef, le_msg_ReceiveHandler_t handlerFunc, void *contextPtr)
void * le_msg_GetSessionContextPtr(le_msg_SessionRef_t sessionRef)
void(* le_msg_SessionEventHandler_t)(le_msg_SessionRef_t sessionRef, void *contextPtr)
Definition: le_messaging.h:865
le_result_t le_msg_TryOpenSessionSync(le_msg_SessionRef_t sessionRef)
void le_msg_AdvertiseService(le_msg_ServiceRef_t serviceRef)
void le_msg_DeleteSession(le_msg_SessionRef_t sessionRef)
const char * le_msg_GetProtocolIdStr(le_msg_ProtocolRef_t protocolRef)
void le_msg_SetSessionRecvHandler(le_msg_SessionRef_t sessionRef, le_msg_ReceiveHandler_t handlerFunc, void *contextPtr)
void * le_msg_GetPayloadPtr(le_msg_MessageRef_t msgRef)
const char * le_msg_GetInterfaceName(le_msg_InterfaceRef_t interfaceRef)
struct le_msg_ClientInterface * le_msg_ClientInterfaceRef_t
Definition: le_messaging.h:828
size_t le_msg_GetMaxPayloadSize(le_msg_MessageRef_t msgRef)
le_msg_SessionRef_t le_msg_GetSession(le_msg_MessageRef_t msgRef)
void le_msg_SetFd(le_msg_MessageRef_t msgRef, int fd)
void(* le_msg_ReceiveHandler_t)(le_msg_MessageRef_t msgRef, void *contextPtr)
Definition: le_messaging.h:884
void le_msg_Send(le_msg_MessageRef_t msgRef)
le_msg_ProtocolRef_t le_msg_GetInterfaceProtocol(le_msg_InterfaceRef_t interfaceRef)
struct le_msg_SessionEventHandler * le_msg_SessionEventHandlerRef_t
Definition: le_messaging.h:850
le_msg_SessionRef_t le_msg_CreateSession(le_msg_ProtocolRef_t protocolRef, const char *interfaceName)
void le_msg_CloseSession(le_msg_SessionRef_t sessionRef)
void le_msg_DeleteService(le_msg_ServiceRef_t serviceRef)
le_msg_ServiceRef_t le_msg_CreateService(le_msg_ProtocolRef_t protocolRef, const char *interfaceName)
le_msg_InterfaceRef_t le_msg_GetSessionInterface(le_msg_SessionRef_t sessionRef)
le_msg_MessageRef_t le_msg_CreateMsg(le_msg_SessionRef_t sessionRef)
le_msg_SessionEventHandlerRef_t le_msg_AddServiceOpenHandler(le_msg_ServiceRef_t serviceRef, le_msg_SessionEventHandler_t handlerFunc, void *contextPtr)
int le_msg_GetFd(le_msg_MessageRef_t msgRef)
struct le_msg_Session * le_msg_SessionRef_t
Definition: le_messaging.h:835
void le_msg_RequestResponse(le_msg_MessageRef_t msgRef, le_msg_ResponseCallback_t handlerFunc, void *contextPtr)
void le_msg_RemoveServiceHandler(le_msg_SessionEventHandlerRef_t handlerRef)
void le_msg_HideService(le_msg_ServiceRef_t serviceRef)
void le_msg_SetSessionContextPtr(le_msg_SessionRef_t sessionRef, void *contextPtr)
le_result_t le_msg_GetClientProcessId(le_msg_SessionRef_t sessionRef, pid_t *processIdPtr)
void le_msg_OpenSession(le_msg_SessionRef_t sessionRef, le_msg_SessionEventHandler_t callbackFunc, void *contextPtr)
void le_msg_SetServiceContextPtr(le_msg_ServiceRef_t serviceRef, void *contextPtr)
le_msg_ProtocolRef_t le_msg_GetSessionProtocol(le_msg_SessionRef_t sessionRef)
void le_msg_Respond(le_msg_MessageRef_t msgRef)
struct le_msg_Protocol * le_msg_ProtocolRef_t
Definition: le_messaging.h:807
void(* le_msg_ResponseCallback_t)(le_msg_MessageRef_t msgRef, void *contextPtr)
Definition: le_messaging.h:904
le_result_t le_msg_GetClientUserId(le_msg_SessionRef_t sessionRef, uid_t *userIdPtr)
le_msg_MessageRef_t le_msg_RequestSyncResponse(le_msg_MessageRef_t msgRef)
struct le_msg_Interface * le_msg_InterfaceRef_t
Definition: le_messaging.h:814
void le_msg_OpenSessionSync(le_msg_SessionRef_t sessionRef)
struct le_msg_Message * le_msg_MessageRef_t
Definition: le_messaging.h:842
struct le_msg_Service * le_msg_ServiceRef_t
Definition: le_messaging.h:821
le_msg_SessionEventHandlerRef_t le_msg_AddServiceCloseHandler(le_msg_ServiceRef_t serviceRef, le_msg_SessionEventHandler_t handlerFunc, void *contextPtr)
void le_msg_SetSessionCloseHandler(le_msg_SessionRef_t sessionRef, le_msg_SessionEventHandler_t handlerFunc, void *contextPtr)