Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

180 lines
4.7 KiB

  1. /*++
  2. Copyright (c) 1992-1997 Microsoft Corporation
  3. Module Name:
  4. network.h
  5. Abstract:
  6. Contains definitions for manipulating transport structures.
  7. Environment:
  8. User Mode - Win32
  9. Revision History:
  10. 10-Feb-1997 DonRyan
  11. Rewrote to implement SNMPv2 support.
  12. --*/
  13. #ifndef _NETWORK_H_
  14. #define _NETWORK_H_
  15. ///////////////////////////////////////////////////////////////////////////////
  16. // //
  17. // Include files //
  18. // //
  19. ///////////////////////////////////////////////////////////////////////////////
  20. ///////////////////////////////////////////////////////////////////////////////
  21. // //
  22. // Public definitions for snmppdus //
  23. // //
  24. ///////////////////////////////////////////////////////////////////////////////
  25. typedef struct _NORMAL_PDU {
  26. AsnInteger32 nRequestId;
  27. AsnInteger32 nErrorStatus;
  28. AsnInteger32 nErrorIndex;
  29. } NORMAL_PDU, *PNORMAL_PDU;
  30. typedef struct _BULK_PDU {
  31. AsnInteger32 nRequestId;
  32. AsnInteger32 nErrorStatus;
  33. AsnInteger32 nErrorIndex;
  34. AsnInteger32 nNonRepeaters;
  35. AsnInteger32 nMaxRepetitions;
  36. } BULK_PDU, *PBULK_PDU;
  37. typedef struct _TRAP_PDU {
  38. AsnObjectIdentifier EnterpriseOid;
  39. AsnIPAddress AgentAddr;
  40. AsnInteger32 nGenericTrap;
  41. AsnInteger32 nSpecificTrap;
  42. AsnTimeticks nTimeticks;
  43. } TRAP_PDU, *PTRAP_PDU;
  44. typedef struct _SNMP_PDU {
  45. UINT nType;
  46. SnmpVarBindList Vbl;
  47. union {
  48. TRAP_PDU TrapPdu;
  49. BULK_PDU BulkPdu;
  50. NORMAL_PDU NormPdu;
  51. } Pdu;
  52. } SNMP_PDU, *PSNMP_PDU;
  53. #define SNMP_VERSION_1 0
  54. #define SNMP_VERSION_2C 1
  55. ///////////////////////////////////////////////////////////////////////////////
  56. // //
  57. // Public definitions for network //
  58. // //
  59. ///////////////////////////////////////////////////////////////////////////////
  60. typedef struct _NETWORK_LIST_ENTRY {
  61. LIST_ENTRY Link;
  62. SOCKET Socket;
  63. struct sockaddr SockAddr;
  64. INT SockAddrLen;
  65. INT SockAddrLenUsed;
  66. WSAOVERLAPPED Overlapped;
  67. DWORD dwStatus;
  68. DWORD dwBytesTransferred;
  69. DWORD dwFlags;
  70. WSABUF Buffer;
  71. LIST_ENTRY Bindings;
  72. LIST_ENTRY Queries;
  73. SNMP_PDU Pdu;
  74. UINT nVersion;
  75. UINT nTransactionId;
  76. BOOL fAccessOk; // authentication succeeds or fails
  77. AsnOctetString Community;
  78. } NETWORK_LIST_ENTRY, *PNETWORK_LIST_ENTRY;
  79. #define NLEBUFLEN 65535
  80. ///////////////////////////////////////////////////////////////////////////////
  81. // //
  82. // Public prototypes for snmppdus //
  83. // //
  84. ///////////////////////////////////////////////////////////////////////////////
  85. BOOL
  86. BuildMessage(
  87. AsnInteger32 nVersion,
  88. AsnOctetString * pCommunity,
  89. PSNMP_PDU pPdu,
  90. PBYTE pMessage,
  91. PDWORD pMessageSize
  92. );
  93. BOOL
  94. ParseMessage(
  95. PNETWORK_LIST_ENTRY pNLE
  96. );
  97. ///////////////////////////////////////////////////////////////////////////////
  98. // //
  99. // Public prototypes for network //
  100. // //
  101. ///////////////////////////////////////////////////////////////////////////////
  102. BOOL
  103. IsValidSockAddr(
  104. struct sockaddr *pAddress
  105. );
  106. BOOL
  107. AllocNLE(
  108. PNETWORK_LIST_ENTRY * ppNLE
  109. );
  110. BOOL
  111. FreeNLE(
  112. PNETWORK_LIST_ENTRY pNLE
  113. );
  114. BOOL
  115. LoadIncomingTransports(
  116. );
  117. BOOL
  118. UnloadTransport(
  119. PNETWORK_LIST_ENTRY pNLE
  120. );
  121. BOOL
  122. UnloadIncomingTransports(
  123. );
  124. BOOL
  125. LoadOutgoingTransports(
  126. );
  127. BOOL
  128. UnloadOutgoingTransports(
  129. );
  130. BOOL
  131. UnloadPdu(
  132. PNETWORK_LIST_ENTRY pNLE
  133. );
  134. #endif // _NETWORK_H_