Source code of Windows XP (NT5)
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.

127 lines
2.9 KiB

  1. //============================================================================
  2. // Copyright(c) 1996, Microsoft Corporation
  3. //
  4. // File: datafmt.h
  5. //
  6. // History:
  7. // 08/30/96 Ram Cherala Created
  8. //
  9. // Class declarations for IPX data formatting routines
  10. // Originally written by VadimE. (this should actually be in the common library)
  11. //=============================================================================
  12. #ifndef _DATAFMT_H_
  13. #define _DATAFMT_H_
  14. class CIPX_NETWORK {
  15. public:
  16. CIPX_NETWORK(PUCHAR net): m_pNet(net) {};
  17. operator PUCHAR () {return m_pNet;};
  18. friend CString& operator << (
  19. CString& str,
  20. CIPX_NETWORK &net
  21. );
  22. friend LPTSTR& operator << (
  23. LPTSTR& str,
  24. CIPX_NETWORK &net
  25. );
  26. friend CString& operator >> (
  27. CString& str,
  28. CIPX_NETWORK &net
  29. );
  30. private:
  31. PUCHAR m_pNet;
  32. CIPX_NETWORK();
  33. };
  34. class CIPX_NODE {
  35. public:
  36. CIPX_NODE(PUCHAR node): m_pNode(node) {};
  37. operator PUCHAR () {return m_pNode;};
  38. friend CString& operator << (
  39. CString& str,
  40. CIPX_NODE &node
  41. );
  42. friend LPTSTR& operator << (
  43. LPTSTR& str,
  44. CIPX_NODE &node
  45. );
  46. friend CString& operator >> (
  47. CString& str,
  48. CIPX_NODE &node
  49. );
  50. private:
  51. PUCHAR m_pNode;
  52. CIPX_NODE();
  53. };
  54. class CIPX_SOCKET {
  55. public:
  56. CIPX_SOCKET(PUCHAR sock): m_pSock(sock) {};
  57. operator PUCHAR () {return m_pSock;};
  58. friend CString& operator << (
  59. CString& str,
  60. CIPX_SOCKET &sock
  61. );
  62. friend LPTSTR& operator << (
  63. LPTSTR& str,
  64. CIPX_SOCKET &sock
  65. );
  66. friend CString& operator >> (
  67. CString& str,
  68. CIPX_SOCKET &sock
  69. );
  70. private:
  71. PUCHAR m_pSock;
  72. CIPX_SOCKET();
  73. };
  74. class CIPX_PACKET_TYPE {
  75. public:
  76. CIPX_PACKET_TYPE(UCHAR type): m_Type(type), m_pType(&m_Type) {};
  77. CIPX_PACKET_TYPE(PUCHAR pType): m_pType(pType) {};
  78. operator USHORT () {return *m_pType;};
  79. friend CString& operator << (
  80. CString& str,
  81. CIPX_PACKET_TYPE& type
  82. );
  83. friend LPTSTR& operator << (
  84. LPTSTR& str,
  85. CIPX_PACKET_TYPE& type
  86. );
  87. friend CString& operator >> (
  88. CString& str,
  89. CIPX_PACKET_TYPE& type
  90. );
  91. private:
  92. UCHAR m_Type;
  93. PUCHAR m_pType;
  94. CIPX_PACKET_TYPE();
  95. };
  96. class CIPX_ADDRESS {
  97. public:
  98. CIPX_ADDRESS (
  99. PUCHAR net,
  100. PUCHAR mask,
  101. PUCHAR node,
  102. PUCHAR sock
  103. ):m_pNet(net), m_pMask(mask), m_pNode(node), m_pSock(sock)
  104. {};
  105. friend LPTSTR& operator << (
  106. LPTSTR& str,
  107. CIPX_ADDRESS& addr
  108. );
  109. friend CString& operator << (
  110. CString& str,
  111. CIPX_ADDRESS& addr
  112. );
  113. private:
  114. PUCHAR m_pNet;
  115. PUCHAR m_pMask;
  116. PUCHAR m_pNode;
  117. PUCHAR m_pSock;
  118. CIPX_ADDRESS();
  119. };
  120. #endif // _DATAFMT_H_