PageRenderTime 44ms CodeModel.GetById 14ms RepoModel.GetById 1ms app.codeStats 0ms

/drivers/net/wireless/tiwlan1251/common/src/core/data_ctrl/Ctrl/4X/ackEmulDb.h

http://github.com/CyanogenMod/cm-kernel
C Header | 240 lines | 140 code | 55 blank | 45 comment | 0 complexity | e4f569a7126105c4acc9188746b40ca8 MD5 | raw file
Possible License(s): AGPL-1.0, GPL-2.0, LGPL-2.0
  1. /****************************************************************************
  2. **+-----------------------------------------------------------------------+**
  3. **| |**
  4. **| Copyright(c) 1998 - 2008 Texas Instruments. All rights reserved. |**
  5. **| All rights reserved. |**
  6. **| |**
  7. **| Redistribution and use in source and binary forms, with or without |**
  8. **| modification, are permitted provided that the following conditions |**
  9. **| are met: |**
  10. **| |**
  11. **| * Redistributions of source code must retain the above copyright |**
  12. **| notice, this list of conditions and the following disclaimer. |**
  13. **| * Redistributions in binary form must reproduce the above copyright |**
  14. **| notice, this list of conditions and the following disclaimer in |**
  15. **| the documentation and/or other materials provided with the |**
  16. **| distribution. |**
  17. **| * Neither the name Texas Instruments nor the names of its |**
  18. **| contributors may be used to endorse or promote products derived |**
  19. **| from this software without specific prior written permission. |**
  20. **| |**
  21. **| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |**
  22. **| "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |**
  23. **| LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |**
  24. **| A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |**
  25. **| OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |**
  26. **| SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |**
  27. **| LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |**
  28. **| DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |**
  29. **| THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |**
  30. **| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |**
  31. **| OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |**
  32. **| |**
  33. **+-----------------------------------------------------------------------+**
  34. ****************************************************************************/
  35. /***************************************************************************/
  36. /* */
  37. /* MODULE: ackEmulDb.h */
  38. /* PURPOSE: Ack emulation database */
  39. /* */
  40. /***************************************************************************/
  41. #ifndef _ACK_EMULATION_DB_H_
  42. #define _ACK_EMULATION_DB_H_
  43. #include "osTIType.h"
  44. #define ACK_EMUL_MODULE_LOG CTRL_DATA_MODULE_LOG
  45. void ackEGetPktType(unsigned char* pPacket , UINT16 *packetInclude, UINT16 *tcpDataSize);
  46. #define TCP_LOOKAHEAD_SIZE 64
  47. #define MAX_ACK_TEMPLATE_SIZE 100
  48. #define MAX_AE_STATIONS 1
  49. #define IP_PROTOCOL_NUMBER 0x0800
  50. #define TCP_PROTOCOL 0x06
  51. #define IP_TOTAL_LEN_FIELD 2
  52. #define IP_IDENTIFIER_FIELD 4
  53. #define IP_PROTOCOL_FIELD 9
  54. #define IP_CHECKSUM_FIELD 10
  55. #define DEST_PORT_FIELD 2
  56. #define IP_SRC_ADDRESS_FIELD 12
  57. #define IP_DEST_ADDRESS_FIELD 16
  58. #define TCP_SEQUENCE_NUMBER_FIELD 4
  59. #define TCP_ACK_NUMBER_FIELD 8
  60. #define TCP_OFFSET_FIELD 12
  61. #define TCP_CHECKSUM_FIELD 16
  62. #define WTARGET_ACTIVE_TIME_OUT 500000 /* was 500 */
  63. #define WTARGET_TERMINATE_TIME_OUT 1000
  64. #define WSOURCE_SESSION_TIME_OUT 700
  65. #define MAX_ACIVE_SESSION 2
  66. #define MAX_STANDBY_SESSION 8
  67. #define INDEX_FREE 0
  68. #define INDEX_BUSY 1
  69. typedef struct {
  70. int lastUsedIndex;
  71. int currentActiveState;
  72. int currentStandbyState;
  73. } sessionsTableManager_T;
  74. typedef struct {
  75. int status; /* INDEX_FREE or INDEX_BUSY */
  76. int monitorIndex ; /* Index in wdrv_aeWTargetTable */
  77. }activeIndexTable_T;
  78. typedef struct {
  79. UINT8 data[MAX_ACK_TEMPLATE_SIZE];
  80. UINT8 ipHeaderLen;
  81. UINT8 tcpHeaderLen;
  82. } ackTemplate_T;
  83. typedef struct {
  84. UINT16 sPorts; /* Include source port */
  85. UINT16 dPorts; /* Include destination port */
  86. UINT32 srcIPAddr; /* source ip address */
  87. UINT32 destIPAddr; /* destination ip address */
  88. UINT32 segmentSize; /* Stable segment size */
  89. UINT32 sequenceNumber; /* The data sequence number */
  90. UINT32 ackNumber; /* Specifies the next byte expected.*/
  91. UINT32 timeStamp; /* */
  92. UINT32 ackCounter; /* The number of 2 * Segement_size in ACK number */
  93. ackTemplate_T ackTemplate; /* Ack template block */
  94. UINT8 monitorState; /* current monitor state */
  95. UINT8 equalSegmentSizeCounter; /* count the number of equal segment size. */
  96. UINT8 yTagFlag; /* True if send Y tag */
  97. UINT8 activeIndex; /* Active session index */
  98. UINT16 sourceStationIndex; /* Source station index */
  99. } ackEmulationWTargetDbTyple_T;
  100. typedef struct {
  101. UINT32 segmentSize; /* Stable segment size */
  102. UINT32 ackNumber; /* Specifies the next byte expected.*/
  103. UINT32 ackCounter; /* The number of 2 * Segement_size in ACK number */
  104. UINT32 timeStamp; /* The number of 2 * Segement_size in ACK number */
  105. UINT32 ackReorderProblem;
  106. ackTemplate_T ackTemplate; /* Ack template block */
  107. }ackEmulationWSourceDbTyple_T;
  108. /* Ack emulation monitor states */
  109. typedef enum {
  110. REORDER_PROBLEM_OFF =0,
  111. REORDER_PROBLEM_ON,
  112. REORDER_PROBLEM_PRE,
  113. } wdrv_eaAckReorderProblem_T;
  114. typedef enum {
  115. AE_INACTIVE =0,
  116. AE_STANDBY,
  117. AE_CANDIDATE_ACTIVE,
  118. AE_ACTIVE,
  119. AE_TERMINATE,
  120. } wdrv_eaMonitorStatus_T;
  121. typedef struct
  122. {
  123. TI_HANDLE hOs;
  124. TI_HANDLE hReport;
  125. /* This table store the WTarget monitor session */
  126. ackEmulationWTargetDbTyple_T wdrv_aeWTargetTable[MAX_ACIVE_SESSION+MAX_STANDBY_SESSION];
  127. sessionsTableManager_T sessionsTableManager;
  128. /* This table store the WSource monitor session */
  129. ackEmulationWSourceDbTyple_T wdrv_aeWSourceTable[MAX_AE_STATIONS][MAX_ACIVE_SESSION];
  130. /* This table store the Xtag status */
  131. UINT8 ackEmulationXTagTable[MAX_AE_STATIONS];
  132. /* This table store the active monitor session index */
  133. activeIndexTable_T activeIndexTable[MAX_ACIVE_SESSION];
  134. }ackEmulDB_t;
  135. ackEmulDB_t* ackEmulDb_create(TI_HANDLE hOs);
  136. TI_STATUS ackEmulDb_config(ackEmulDB_t* ackEmulDB,
  137. TI_HANDLE hOs,
  138. TI_HANDLE hReport);
  139. TI_STATUS ackEmulDb_destroy(ackEmulDB_t* ackEmulDB);
  140. void wdrv_aeDbInit(ackEmulDB_t* ackEmulDB);
  141. void wdrv_aeWTargetDbPrint(ackEmulDB_t* ackEmulDB);
  142. int wdrv_aeWTargetDbFindDataSession(ackEmulDB_t* ackEmulDB,UINT8 *pktBuf,UINT8 *sessionIndex, UINT8 *monitorState);
  143. int wdrv_aeWTargetDbFindAckSession(ackEmulDB_t* ackEmulDB,UINT8 *pktBuf,UINT8 *sessionIndex, UINT8 *monitorState);
  144. int wdrv_aeWTargetDbAddSession(ackEmulDB_t* ackEmulDB,UINT8 *pktBuf);
  145. int wdrv_aeWTargetDbDelSession(ackEmulDB_t* ackEmulDB,UINT8 SessionIndex);
  146. int wdrv_aeWTargetDbSetActiveState(ackEmulDB_t* ackEmulDB,UINT8 index , UINT8 *activeIndex);
  147. void wdrv_aeWTargetDbSaveAckTemplate(ackEmulDB_t* ackEmulDB,UINT8 index, UINT8 *pIpHeader);
  148. void wdrv_aeWTargetDbUpdateAckTemplate(ackEmulDB_t* ackEmulDB,UINT8 index, UINT32 sequenceNumber);
  149. int wdrv_aeWTargetDbCmpAckTemplate(ackEmulDB_t* ackEmulDB,UINT8 index, UINT8 *pIpHeader);
  150. void wdrv_aeWTargetDbResetTuple(ackEmulDB_t* ackEmulDB,int index);
  151. void wdrv_aeWTargetDbGetSessionSequenceNumber(ackEmulDB_t* ackEmulDB,UINT8 index, UINT32 *sequenceNumber);
  152. void wdrv_aeWTargetDbGetSessionAckNumber(ackEmulDB_t* ackEmulDB,UINT8 index, UINT32 *ackNumber);
  153. void wdrv_aeWTargetDbGetSessionSegmentSize(ackEmulDB_t* ackEmulDB,UINT8 index, UINT32 *segmentSize);
  154. void wdrv_aeWTargetDbGetIncrSessionEqualSegmentSizeCounter(ackEmulDB_t* ackEmulDB,UINT8 index, UINT8 *equalSegmentSizeCounter);
  155. void wdrv_aeWTargetDbGetSessionAckCounter(ackEmulDB_t* ackEmulDB,UINT8 index, UINT32 *ackCounter);
  156. void wdrv_aeWTargetDbGetSessionMmonitorState(ackEmulDB_t* ackEmulDB,UINT8 index, UINT8 *monitorState);
  157. void wdrv_aeWTargetDbGetSessionActiveIndex(ackEmulDB_t* ackEmulDB,UINT8 index, UINT8 *activeIndex);
  158. void wdrv_aeWTargetDbSetSessionSequenceNumber(ackEmulDB_t* ackEmulDB,UINT8 index, UINT32 sequenceNumber);
  159. void wdrv_aeWTargetDbSetSessionAckNumber(ackEmulDB_t* ackEmulDB,UINT8 index, UINT32 ackNumber);
  160. void wdrv_aeWTargetDbSetSessionSegmentSize(ackEmulDB_t* ackEmulDB,UINT8 index, UINT32 segmentSize);
  161. void wdrv_aeWTargetDbSetSessionAckCounter(ackEmulDB_t* ackEmulDB,UINT8 index, UINT32 ackCounter);
  162. void wdrv_aeWTargetDbSetSessionMonitorState(ackEmulDB_t* ackEmulDB,UINT8 index, UINT8 monitorState);
  163. void wdrv_aeWTargetDbSetSessionEqualSegmentSizeCounter(ackEmulDB_t* ackEmulDB,UINT8 index, UINT8 equalSegmentSizeCounter);
  164. void wdrv_aeWTargetDbGetSessionTimeStamp(ackEmulDB_t* ackEmulDB,UINT8 index, UINT32 *timeStamp);
  165. void wdrv_aeWTargetDbSetSessionTimeStamp(ackEmulDB_t* ackEmulDB,UINT8 index, UINT32 timeStamp);
  166. void wdrv_aeWSourceDbUpdateTemplate(ackEmulDB_t* ackEmulDB,UINT8 *pktBuf,UINT8 stationIndex,UINT8 *sessionIndex);
  167. void wdrv_aeWSourceDbResetSession(ackEmulDB_t* ackEmulDB,int stationIndex,int activeIndex);
  168. void wdrv_aeWSourceSaveAckTemplate(ackEmulDB_t* ackEmulDB,UINT8 stationIndex,UINT8 activeIndex,
  169. UINT8* pDot11Header, UINT8 *pWlanSnapHeader, UINT8 *pIpHeader
  170. ,UINT16 dataLen,UINT16 segmentSize);
  171. void wdrv_aeWSourceDbGetSessionAckCounter(ackEmulDB_t* ackEmulDB,UINT16 stationIndex, UINT8 activeIndex, UINT32 *ackCounter);
  172. void wdrv_aeWSourceDbSetSessionAckCounter(ackEmulDB_t* ackEmulDB,UINT16 stationIndex, UINT8 activeIndex, UINT32 ackCounter);
  173. void wdrv_aeWSourceDbGetSessionAckNumber(ackEmulDB_t* ackEmulDB,UINT16 stationIndex, UINT8 activeIndex, UINT32 *ackNumber);
  174. void wdrv_aeWSourceDbSetSessionAckNumber(ackEmulDB_t* ackEmulDB,UINT16 stationIndex, UINT8 activeIndex, UINT32 ackNumber);
  175. void wdrv_aeWSourceDbGetSessionSegmentSize(ackEmulDB_t* ackEmulDB,UINT16 stationIndex, UINT8 activeIndex, UINT32 *segmentSize);
  176. void wdrv_aeWSourceDbSetSessionSegmentSize(ackEmulDB_t* ackEmulDB,UINT16 stationIndex, UINT8 activeIndex, UINT32 segmentSize);
  177. void wdrv_aeWSourceDbGetSessionTimeStamp(ackEmulDB_t* ackEmulDB,UINT16 stationIndex, UINT8 activeIndex, UINT32 *timeStamp);
  178. void wdrv_aeWSourceDbSetSessionTimeStamp(ackEmulDB_t* ackEmulDB,UINT16 stationIndex, UINT8 activeIndex, UINT32 timeStamp);
  179. void wdrv_aeWSourceDbGetSessionAckReorderProblem(ackEmulDB_t* ackEmulDB,UINT16 stationIndex, UINT8 activeIndex, UINT32 *ackReorderProblem);
  180. void wdrv_aeWSourceDbSetSessionAckReorderProblem(ackEmulDB_t* ackEmulDB,UINT16 stationIndex, UINT8 activeIndex, UINT32 ackReorderProblem);
  181. void wdrv_aeWSourceDbGetAckTemplate(ackEmulDB_t* ackEmulDB,UINT16 stationIndex, UINT8 activeIndex, UINT8 **pTeplate,
  182. UINT8 *ipHeaderLen, UINT8 *tcpHeaderLen);
  183. void wdrv_aeDbGetXTagStatus(ackEmulDB_t* ackEmulDB,UINT8 sessionIndex, UINT8 *status);
  184. void wdrv_aeDbSetXTagStatus(ackEmulDB_t* ackEmulDB,UINT8 sessionIndex, UINT8 status);
  185. #endif