com_Message.h 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. /*****************************************************************
  2. *****************************************************************
  3. *** **
  4. *** (C)Copyright 2005-2006, American Megatrends Inc. **
  5. *** **
  6. *** All Rights Reserved. **
  7. *** **
  8. *** 6145-F, Northbelt Parkway, Norcross, **
  9. *** **
  10. *** Georgia - 30071, USA. Phone-(770)-246-8600. **
  11. *** **
  12. *****************************************************************
  13. *****************************************************************
  14. ******************************************************************
  15. *
  16. * message.h
  17. * Inter task messaging functions.
  18. *
  19. * Author: Govind Kothandapani <govindk@ami.com>
  20. ******************************************************************/
  21. #ifndef MESSAGE_H
  22. #define MESSAGE_H
  23. #ifndef uint8_t
  24. #define uint8_t unsigned char
  25. #endif
  26. #ifndef uint16_t
  27. #define uint16_t unsigned short
  28. #endif
  29. #ifndef uint32_t
  30. #define uint32_t unsigned long
  31. #endif
  32. #pragma pack( 1 )
  33. #define IP_ADDR_LEN 4
  34. #define IP6_ADDR_LEN 16
  35. #define COMMON_QUEUE 0
  36. /*-----------------------------------
  37. * Definitions
  38. *-----------------------------------*/
  39. #define MSG_PAYLOAD_SIZE 1024
  40. #define PIPE_NAME_LEN 64
  41. /*-----------------------------------
  42. * Type definitions
  43. *-----------------------------------*/
  44. typedef struct
  45. {
  46. uint32_t Param; /* Parameter */
  47. uint8_t Channel; /* Originator's channel number */
  48. int SrcQ ; /* Originator Queue, fd */
  49. uint8_t Cmd; /* Command that needs to be processed*/
  50. uint8_t NetFnLUN; /* Net function and LUN of command */
  51. uint8_t Privilege; /* Current privilege level */
  52. uint32_t SessionID; /* Session ID if any */
  53. // time_t ReqTime; /* Request Timestamp */
  54. uint16_t ResTimeOut; /* response timeout in secs */
  55. uint16_t SessionType; /* Session Type */
  56. uint8_t IPAddr [IP6_ADDR_LEN]; /* IPv6 Address */
  57. uint16_t UDPPort; /* UDP Port Number */
  58. uint16_t Socket; /* socket handle */
  59. uint32_t Size; /* Size of the data */
  60. uint8_t Data [MSG_PAYLOAD_SIZE]; /* Data */
  61. } MsgPkt_T;
  62. #pragma pack( )
  63. // /**
  64. // * @brief Initialisation
  65. // * @return 0 if success, -1 if failed.
  66. // **/
  67. // extern int InitMsg (void);
  68. // /**
  69. // * @fn PostMsg
  70. // * @brief Post a message to the destination task.
  71. // * @param MsgPkt - Message to be posted.
  72. // * @param Queue - Queue to post this message to.
  73. // * @return 0 if success, -1 if failed.
  74. // **/
  75. // extern int PostMsg (_FAR_ MsgPkt_T* pMsgPkt, INT8S *Queuepath ,int BMCInst);
  76. // /**
  77. // * @fn PostMsgNonBlock
  78. // * @brief Post a message to the destination task without blocking.
  79. // * @param MsgPkt - Message to be posted.
  80. // * @param Queue - Queue to post this message to.
  81. // * @return 0 if success, -1 if failed.
  82. // **/
  83. // extern int PostMsgNonBlock (_FAR_ MsgPkt_T* pMsgPkt, INT8S *Queuepath, int BMCInst );
  84. // /**
  85. // * @fn AddToQueue
  86. // * @brief Post a buffer to the destination task.
  87. // * @param pBuf - Buffer to be posted.
  88. // * @param Queuepath - Queuepath to post this buffer to.
  89. // * @return 0 if success, -1 if failed.
  90. // **/
  91. // extern int AddToQueue (void* pBuf, INT8S *Queuepath,uint32_t Size,int BMCInst);
  92. // *
  93. // * @fn GetMsg
  94. // * @brief Gets the message posted to this task.
  95. // * @param MsgPkt - Pointer to the buffer to hold the message packet.
  96. // * @param Queue - Queue to fetch the message from.
  97. // * @param NumMs - Number of milli-seconds to wait.
  98. // * WAIT_NONE - If the function has to return immediately.
  99. // * WAIT_INFINITE - If the function has to wait infinitely.
  100. // * NOTE :
  101. // * @return 0 if success, -1 if failed.
  102. // *
  103. // extern int GetMsg (_FAR_ MsgPkt_T* pMsgPkt, INT8S *Queuepath, INT16S Timeout, int BMCInst);
  104. // /**
  105. // * @fn GetMsgInMsec
  106. // * @brief GetMsgInMsec() is wrapper function over GetMsg() and it is maintained for backward compatibality.
  107. // * */
  108. // extern int GetMsgInMsec (_FAR_ MsgPkt_T* pMsgPkt, INT8S *Queuepath, INT16S Timeout, int BMCInst);
  109. // /**
  110. // * @brief Returns the number of messages in the Queue.
  111. // * @param Queue Queue.
  112. // **/
  113. // extern int NumMsg (HQueue_T Queue);
  114. // /**
  115. // * @fn AddQueue
  116. // * @brief Adds the Queue to the common Queue Handle structure
  117. // * @param Queuepath - Queue Path
  118. // **/
  119. // extern int AddQueue(INT8S *Queuepath);
  120. // /**
  121. // * @fn GetQueue
  122. // * @brief Opens the Created Queue Handle from the Common
  123. // * Queue Handle Structure
  124. // * @param Queuepath - Queue Path
  125. // * @return Return 0
  126. // **/
  127. // extern int GetQueue(INT8S *Queuepath,int flags);
  128. // /**
  129. // * @fn GetQueueHandle
  130. // * @brief Gets the Queue Handle from the Common
  131. // * Queue Handle Structure
  132. // * @param Queuepath - Queue Path
  133. // * @param IfcQ Handle for the needed Queue
  134. // * @return Return 0
  135. // **/
  136. // extern int GetQueueHandle(INT8S *Queuepath,HQueue_T *IfcQ,int BMCInst);
  137. #endif /* MESSAGE_H */