All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
le_messaging.h
Go to the documentation of this file.
1 
808 #ifndef LE_MESSAGING_H_INCLUDE_GUARD
809 #define LE_MESSAGING_H_INCLUDE_GUARD
810 
811 // =======================================
812 // DATA TYPES
813 // =======================================
814 
815 //--------------------------------------------------------------------------------------------------
819 //--------------------------------------------------------------------------------------------------
820 typedef struct le_msg_Protocol* le_msg_ProtocolRef_t;
821 
822 //--------------------------------------------------------------------------------------------------
826 //--------------------------------------------------------------------------------------------------
827 typedef struct le_msg_Service* le_msg_ServiceRef_t;
828 
829 //--------------------------------------------------------------------------------------------------
833 //--------------------------------------------------------------------------------------------------
834 typedef struct le_msg_Session* le_msg_SessionRef_t;
835 
836 //--------------------------------------------------------------------------------------------------
840 //--------------------------------------------------------------------------------------------------
841 typedef struct le_msg_Message* le_msg_MessageRef_t;
842 
843 
844 //--------------------------------------------------------------------------------------------------
855 //--------------------------------------------------------------------------------------------------
856 typedef void (* le_msg_SessionEventHandler_t)
857 (
858  le_msg_SessionRef_t sessionRef,
859  void* contextPtr
860 );
861 
862 
863 //--------------------------------------------------------------------------------------------------
874 //--------------------------------------------------------------------------------------------------
875 typedef void (* le_msg_ReceiveHandler_t)
876 (
877  le_msg_MessageRef_t msgRef,
878  void* contextPtr
879 );
880 
881 
882 //--------------------------------------------------------------------------------------------------
894 //--------------------------------------------------------------------------------------------------
895 typedef void (* le_msg_ResponseCallback_t)
896 (
897  le_msg_MessageRef_t msgRef,
898  void* contextPtr
899 );
900 
901 
902 // =======================================
903 // PROTOCOL FUNCTIONS
904 // =======================================
905 
906 //--------------------------------------------------------------------------------------------------
914 //--------------------------------------------------------------------------------------------------
916 (
917  const char* protocolId,
918  size_t largestMsgSize
919 );
920 
921 
922 //--------------------------------------------------------------------------------------------------
928 //--------------------------------------------------------------------------------------------------
929 const char* le_msg_GetProtocolIdStr
930 (
931  le_msg_ProtocolRef_t protocolRef
932 );
933 
934 
935 //--------------------------------------------------------------------------------------------------
941 //--------------------------------------------------------------------------------------------------
943 (
944  le_msg_ProtocolRef_t protocolRef
945 );
946 
947 
948 // =======================================
949 // SESSION FUNCTIONS
950 // =======================================
951 
952 //--------------------------------------------------------------------------------------------------
962 //--------------------------------------------------------------------------------------------------
964 (
965  le_msg_ProtocolRef_t protocolRef,
966  const char* serviceName
967 );
968 
969 
970 //--------------------------------------------------------------------------------------------------
975 //--------------------------------------------------------------------------------------------------
977 (
978  le_msg_SessionRef_t sessionRef,
979 
980  void* contextPtr
981 );
983 
984 //--------------------------------------------------------------------------------------------------
992 //--------------------------------------------------------------------------------------------------
994 (
995  le_msg_SessionRef_t sessionRef
996 );
997 
998 
999 //--------------------------------------------------------------------------------------------------
1008 //--------------------------------------------------------------------------------------------------
1010 (
1011  le_msg_SessionRef_t sessionRef
1012 );
1013 
1014 
1015 //--------------------------------------------------------------------------------------------------
1028 //--------------------------------------------------------------------------------------------------
1030 (
1031  le_msg_SessionRef_t sessionRef,
1032  le_msg_ReceiveHandler_t handlerFunc,
1033  void* contextPtr
1034 );
1035 
1036 
1037 //--------------------------------------------------------------------------------------------------
1054 //--------------------------------------------------------------------------------------------------
1056 (
1057  le_msg_SessionRef_t sessionRef,
1058  le_msg_SessionEventHandler_t handlerFunc,
1059  void* contextPtr
1060 );
1061 
1062 
1063 //--------------------------------------------------------------------------------------------------
1075 //--------------------------------------------------------------------------------------------------
1076 void le_msg_OpenSession
1077 (
1078  le_msg_SessionRef_t sessionRef,
1079  le_msg_SessionEventHandler_t callbackFunc,
1080  void* contextPtr
1082 );
1083 
1084 
1085 //--------------------------------------------------------------------------------------------------
1099 //--------------------------------------------------------------------------------------------------
1101 (
1102  le_msg_SessionRef_t sessionRef
1103 );
1104 
1105 
1106 //--------------------------------------------------------------------------------------------------
1110 //--------------------------------------------------------------------------------------------------
1112 (
1113  le_msg_SessionRef_t sessionRef
1114 );
1115 
1116 
1117 //--------------------------------------------------------------------------------------------------
1123 //--------------------------------------------------------------------------------------------------
1125 (
1126  le_msg_SessionRef_t sessionRef
1127 );
1128 
1129 
1130 //--------------------------------------------------------------------------------------------------
1136 //--------------------------------------------------------------------------------------------------
1138 (
1139  le_msg_SessionRef_t sessionRef
1140 );
1141 
1142 //--------------------------------------------------------------------------------------------------
1151 //--------------------------------------------------------------------------------------------------
1153 (
1154  le_msg_SessionRef_t sessionRef,
1155  uid_t* userIdPtr
1156 );
1157 //--------------------------------------------------------------------------------------------------
1166 //--------------------------------------------------------------------------------------------------
1168 (
1169  le_msg_SessionRef_t sessionRef,
1170  pid_t* processIdPtr
1171 );
1172 
1173 //--------------------------------------------------------------------------------------------------
1182 //--------------------------------------------------------------------------------------------------
1184 (
1185  le_msg_SessionRef_t sessionRef,
1186  uid_t* userIdPtr,
1187  pid_t* processIdPtr
1188 );
1189 
1190 
1191 
1192 // =======================================
1193 // MESSAGE FUNCTIONS
1194 // =======================================
1195 
1196 //--------------------------------------------------------------------------------------------------
1207 //--------------------------------------------------------------------------------------------------
1209 (
1210  le_msg_SessionRef_t sessionRef
1211 );
1212 
1213 
1214 //--------------------------------------------------------------------------------------------------
1218 //--------------------------------------------------------------------------------------------------
1219 void le_msg_AddRef
1220 (
1221  le_msg_MessageRef_t msgRef
1222 );
1223 
1224 
1225 //--------------------------------------------------------------------------------------------------
1230 //--------------------------------------------------------------------------------------------------
1231 void le_msg_ReleaseMsg
1232 (
1233  le_msg_MessageRef_t msgRef
1234 );
1235 
1236 
1237 //--------------------------------------------------------------------------------------------------
1248 //--------------------------------------------------------------------------------------------------
1250 (
1251  le_msg_MessageRef_t msgRef
1252 );
1253 
1254 
1255 //--------------------------------------------------------------------------------------------------
1263 //--------------------------------------------------------------------------------------------------
1265 (
1266  le_msg_MessageRef_t msgRef
1267 );
1268 
1269 
1270 //--------------------------------------------------------------------------------------------------
1276 //--------------------------------------------------------------------------------------------------
1278 (
1279  le_msg_MessageRef_t msgRef
1280 );
1281 
1282 
1283 //--------------------------------------------------------------------------------------------------
1292 //--------------------------------------------------------------------------------------------------
1293 void le_msg_SetFd
1294 (
1295  le_msg_MessageRef_t msgRef,
1296  int fd
1297 );
1298 
1299 
1300 //--------------------------------------------------------------------------------------------------
1307 //--------------------------------------------------------------------------------------------------
1308 int le_msg_GetFd
1309 (
1310  le_msg_MessageRef_t msgRef
1311 );
1312 
1313 
1314 //--------------------------------------------------------------------------------------------------
1318 //--------------------------------------------------------------------------------------------------
1319 void le_msg_Send
1320 (
1321  le_msg_MessageRef_t msgRef
1322 );
1323 
1324 
1325 //--------------------------------------------------------------------------------------------------
1331 //--------------------------------------------------------------------------------------------------
1333 (
1334  le_msg_MessageRef_t msgRef
1335 );
1336 
1337 
1338 //--------------------------------------------------------------------------------------------------
1351 //--------------------------------------------------------------------------------------------------
1353 (
1354  le_msg_MessageRef_t msgRef,
1355  le_msg_ResponseCallback_t handlerFunc,
1356  void* contextPtr
1357 );
1358 
1359 
1360 //--------------------------------------------------------------------------------------------------
1387 //--------------------------------------------------------------------------------------------------
1389 (
1390  le_msg_MessageRef_t msgRef
1391 );
1392 
1393 
1394 //--------------------------------------------------------------------------------------------------
1406 //--------------------------------------------------------------------------------------------------
1407 void le_msg_Respond
1408 (
1409  le_msg_MessageRef_t msgRef
1410 );
1411 
1412 
1413 // =======================================
1414 // SERVICE FUNCTIONS
1415 // =======================================
1416 
1417 //--------------------------------------------------------------------------------------------------
1423 //--------------------------------------------------------------------------------------------------
1425 (
1426  le_msg_ProtocolRef_t protocolRef,
1427  const char* serviceName
1428 );
1429 
1430 
1431 //--------------------------------------------------------------------------------------------------
1437 //--------------------------------------------------------------------------------------------------
1439 (
1440  le_msg_ServiceRef_t serviceRef
1441 );
1442 
1443 
1444 //--------------------------------------------------------------------------------------------------
1450 //--------------------------------------------------------------------------------------------------
1452 (
1453  le_msg_ServiceRef_t serviceRef,
1454  le_msg_SessionEventHandler_t handlerFunc,
1455  void* contextPtr
1456 );
1457 
1458 
1459 //--------------------------------------------------------------------------------------------------
1464 //--------------------------------------------------------------------------------------------------
1466 (
1467  le_msg_ServiceRef_t serviceRef,
1468  le_msg_SessionEventHandler_t* handlerFunc,
1469  void** contextPtr
1470 );
1471 
1472 
1473 //--------------------------------------------------------------------------------------------------
1480 //--------------------------------------------------------------------------------------------------
1482 (
1483  le_msg_ServiceRef_t serviceRef,
1484  le_msg_SessionEventHandler_t handlerFunc,
1485  void* contextPtr
1486 );
1487 
1488 
1489 //--------------------------------------------------------------------------------------------------
1494 //--------------------------------------------------------------------------------------------------
1496 (
1497  le_msg_ServiceRef_t serviceRef,
1498  le_msg_SessionEventHandler_t* handlerFunc,
1499  void** contextPtr
1500 );
1501 
1502 
1503 //--------------------------------------------------------------------------------------------------
1510 //--------------------------------------------------------------------------------------------------
1512 (
1513  le_msg_ServiceRef_t serviceRef,
1514  le_msg_ReceiveHandler_t handlerFunc,
1515  void* contextPtr
1516 );
1517 
1518 
1519 //--------------------------------------------------------------------------------------------------
1526 //--------------------------------------------------------------------------------------------------
1528 (
1529  le_msg_ServiceRef_t serviceRef,
1530 
1531  void* contextPtr
1532 );
1534 
1535 
1536 //--------------------------------------------------------------------------------------------------
1546 //--------------------------------------------------------------------------------------------------
1548 (
1549  le_msg_ServiceRef_t serviceRef
1550 );
1551 
1552 
1553 //--------------------------------------------------------------------------------------------------
1559 //--------------------------------------------------------------------------------------------------
1561 (
1562  le_msg_ServiceRef_t serviceRef
1563 );
1564 
1565 
1566 //--------------------------------------------------------------------------------------------------
1573 //--------------------------------------------------------------------------------------------------
1574 void le_msg_HideService
1575 (
1576  le_msg_ServiceRef_t serviceRef
1577 );
1578 
1579 //--------------------------------------------------------------------------------------------------
1587 //--------------------------------------------------------------------------------------------------
1588 const char* le_msg_GetServiceName
1589 (
1590  le_msg_ServiceRef_t serviceRef
1591 );
1592 
1593 
1594 //--------------------------------------------------------------------------------------------------
1600 //--------------------------------------------------------------------------------------------------
1602 (
1603  le_msg_ServiceRef_t serviceRef
1604 );
1605 
1606 
1607 //--------------------------------------------------------------------------------------------------
1615 //--------------------------------------------------------------------------------------------------
1617 (
1618  void
1619 );
1620 
1621 
1622 //--------------------------------------------------------------------------------------------------
1629 //--------------------------------------------------------------------------------------------------
1630 #define LE_KILL_CLIENT(formatString, ...) \
1631 { \
1632  le_msg_MessageRef_t msgRef = le_msg_GetServiceRxMsg(); \
1633  LE_FATAL_IF(msgRef == NULL, formatString, ##__VA_ARGS__); \
1634  LE_EMERG(formatString, ##__VA_ARGS__); \
1635  le_msg_CloseSession(le_msg_GetSession(msgRef)); \
1636 }
1637 
1638 #endif // LEGATO_MESSAGING_INCLUDE_GUARD
void le_msg_GetServiceOpenHandler(le_msg_ServiceRef_t serviceRef, le_msg_SessionEventHandler_t *handlerFunc, void **contextPtr)
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)
void(* le_msg_SessionEventHandler_t)(le_msg_SessionRef_t sessionRef, void *contextPtr)
Definition: le_messaging.h:857
le_result_t
Definition: le_basics.h:34
void * le_msg_GetServiceContextPtr(le_msg_ServiceRef_t serviceRef)
le_msg_SessionRef_t le_msg_CreateSession(le_msg_ProtocolRef_t protocolRef, const char *serviceName)
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_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)
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_Send(le_msg_MessageRef_t msgRef)
le_msg_ServiceRef_t le_msg_GetSessionService(le_msg_SessionRef_t sessionRef)
void le_msg_CloseSession(le_msg_SessionRef_t sessionRef)
void le_msg_DeleteService(le_msg_ServiceRef_t serviceRef)
le_msg_MessageRef_t le_msg_CreateMsg(le_msg_SessionRef_t sessionRef)
int le_msg_GetFd(le_msg_MessageRef_t msgRef)
struct le_msg_Session * le_msg_SessionRef_t
Definition: le_messaging.h:834
void le_msg_SetServiceCloseHandler(le_msg_ServiceRef_t serviceRef, le_msg_SessionEventHandler_t handlerFunc, void *contextPtr)
void le_msg_RequestResponse(le_msg_MessageRef_t msgRef, le_msg_ResponseCallback_t handlerFunc, void *contextPtr)
void le_msg_HideService(le_msg_ServiceRef_t serviceRef)
void le_msg_GetServiceCloseHandler(le_msg_ServiceRef_t serviceRef, le_msg_SessionEventHandler_t *handlerFunc, void **contextPtr)
void le_msg_SetSessionContextPtr(le_msg_SessionRef_t sessionRef, void *contextPtr)
const char * le_msg_GetServiceName(le_msg_ServiceRef_t serviceRef)
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:820
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)
void le_msg_SetServiceOpenHandler(le_msg_ServiceRef_t serviceRef, le_msg_SessionEventHandler_t handlerFunc, void *contextPtr)
void le_msg_OpenSessionSync(le_msg_SessionRef_t sessionRef)
struct le_msg_Message * le_msg_MessageRef_t
Definition: le_messaging.h:841
le_msg_ServiceRef_t le_msg_CreateService(le_msg_ProtocolRef_t protocolRef, const char *serviceName)
void(* le_msg_ResponseCallback_t)(le_msg_MessageRef_t msgRef, void *contextPtr)
Definition: le_messaging.h:896
void(* le_msg_ReceiveHandler_t)(le_msg_MessageRef_t msgRef, void *contextPtr)
Definition: le_messaging.h:876
struct le_msg_Service * le_msg_ServiceRef_t
Definition: le_messaging.h:827
le_msg_ProtocolRef_t le_msg_GetServiceProtocol(le_msg_ServiceRef_t serviceRef)
void le_msg_SetSessionCloseHandler(le_msg_SessionRef_t sessionRef, le_msg_SessionEventHandler_t handlerFunc, void *contextPtr)