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.

208 lines
3.2 KiB

  1. /*++
  2. Copyright (c) 1991 Microsoft Corporation
  3. Module Name:
  4. tcpcmd.h
  5. Abstract:
  6. Common header file for all tcpcmd programs.
  7. Author:
  8. Mike Massa (mikemas) Jan 31, 1992
  9. Revision History:
  10. Who When What
  11. -------- -------- ----------------------------------------------
  12. mikemas 01-31-92 created
  13. Notes:
  14. --*/
  15. #ifndef TCPCMD_INCLUDED
  16. #define TCPCMD_INCLUDED
  17. #ifndef WIN16
  18. #include <nt.h>
  19. #include <ntrtl.h>
  20. #include <nturtl.h>
  21. #endif // WIN16
  22. #define NOGDI
  23. #define NOMINMAX
  24. #include <windef.h>
  25. #include <winbase.h>
  26. #include <winsock2.h>
  27. #include <ws2tcpip.h>
  28. #ifndef WIN16
  29. #endif // WIN16
  30. #include <direct.h>
  31. #include <io.h>
  32. #include <stdlib.h>
  33. #include <stdio.h>
  34. #include <time.h>
  35. #include <string.h>
  36. #include <nls.h>
  37. //
  38. // global variable declarations
  39. //
  40. extern int optind;
  41. extern int opterr;
  42. extern char *optarg;
  43. //
  44. // function prototypes
  45. //
  46. char *
  47. GetFileFromPath(
  48. char *);
  49. HANDLE
  50. OpenStream(
  51. char *);
  52. int
  53. lwccmp(
  54. char *,
  55. char *);
  56. long
  57. netnumber(
  58. char *);
  59. long
  60. hostnumber(
  61. char *);
  62. void
  63. blkfree(
  64. char **);
  65. struct sockaddr_storage *
  66. resolve_host(
  67. char *,
  68. int *);
  69. int
  70. resolve_port(
  71. char *,
  72. char *);
  73. char *
  74. tempfile(
  75. char *);
  76. char *
  77. udp_alloc(
  78. unsigned int);
  79. void
  80. udp_close(
  81. SOCKET);
  82. void
  83. udp_free(
  84. char *);
  85. SOCKET
  86. udp_open(
  87. int,
  88. int *);
  89. int
  90. udp_port(void);
  91. int
  92. udp_port_used(
  93. int,
  94. int);
  95. int
  96. udp_read(
  97. SOCKET,
  98. char *,
  99. int,
  100. struct sockaddr_storage *,
  101. int *,
  102. int);
  103. int
  104. udp_write(
  105. SOCKET,
  106. char *,
  107. int,
  108. struct sockaddr_storage *,
  109. int);
  110. void
  111. gate_ioctl(
  112. HANDLE,
  113. int,
  114. int,
  115. int,
  116. long,
  117. long);
  118. void
  119. get_route_table(void);
  120. int
  121. tcpcmd_send(
  122. SOCKET s, // socket descriptor
  123. char *buf, // data buffer
  124. int len, // length of data buffer
  125. int flags // transmission flags
  126. );
  127. void
  128. s_perror(
  129. char *yourmsg, // your message to be displayed
  130. int lerrno // errno to be converted
  131. );
  132. void fatal(char * message);
  133. #ifndef WIN16
  134. struct netent *getnetbyname(IN char *name);
  135. unsigned long inet_network(IN char *cp);
  136. #endif // WIN16
  137. #define perror(string) s_perror(string, (int)GetLastError())
  138. #define HZ 1000
  139. #define TCGETA 0x4
  140. #define TCSETA 0x10
  141. #define ECHO 17
  142. #define SIGPIPE 99
  143. #define MAX_RETRANSMISSION_COUNT 8
  144. #define MAX_RETRANSMISSION_TIME 8 // in seconds
  145. // if x is aabbccdd (where aa, bb, cc, dd are hex bytes)
  146. // we want net_long(x) to be ddccbbaa. A small and fast way to do this is
  147. // to first byteswap it to get bbaaddcc and then swap high and low words.
  148. //
  149. __inline
  150. ULONG
  151. FASTCALL
  152. net_long(
  153. ULONG x)
  154. {
  155. register ULONG byteswapped;
  156. byteswapped = ((x & 0x00ff00ff) << 8) | ((x & 0xff00ff00) >> 8);
  157. return (byteswapped << 16) | (byteswapped >> 16);
  158. }
  159. #endif //TCPCMD_INCLUDED