com_Message.h 5.3 KB

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