HTTCP.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. /* /Net/dxcern/userd/timbl/hypertext/WWW/Library/src/HTTCP.html
  2. GENERIC TCP/IP COMMUNICATION
  3. This module has the common code for handling TCP/IP connections etc.
  4. */
  5. #ifndef HTTCP_H
  6. #define HTTCP_H
  7. #ifndef HTUTILS_H
  8. #include <HTUtils.h>
  9. #endif
  10. #ifdef __cplusplus
  11. extern "C" {
  12. #endif
  13. /* Produce a string for an internet address
  14. * ---------------------------------------
  15. *
  16. * On exit:
  17. * returns a pointer to a static string which must be copied if
  18. * it is to be kept.
  19. */
  20. #ifdef INET6
  21. extern const char *HTInetString(SockA * mysin);
  22. #else
  23. extern const char *HTInetString(struct sockaddr_in *mysin);
  24. #endif /* INET6 */
  25. /* Encode INET status (as in sys/errno.h) inet_status()
  26. * ------------------
  27. *
  28. * On entry:
  29. * where gives a description of what caused the error
  30. * global errno gives the error number in the unix way.
  31. *
  32. * On return:
  33. * returns a negative status in the unix way.
  34. */
  35. extern int HTInetStatus(const char *where);
  36. /* Publicly accessible variables
  37. */
  38. /* extern struct sockaddr_in HTHostAddress; */
  39. /* The internet address of the host */
  40. /* Valid after call to HTHostName() */
  41. /* Parse a cardinal value parse_cardinal()
  42. * ----------------------
  43. *
  44. * On entry:
  45. * *pp points to first character to be interpreted, terminated by
  46. * non 0..9 character.
  47. * *pstatus points to status already valid,
  48. * maxvalue gives the largest allowable value.
  49. *
  50. * On exit:
  51. * *pp points to first unread character,
  52. * *pstatus points to status updated iff bad
  53. */
  54. extern unsigned int HTCardinal(int *pstatus,
  55. char **pp,
  56. unsigned int max_value);
  57. /* Check whether string is a valid Internet hostname
  58. * -------------------------------------------------
  59. */
  60. extern BOOL valid_hostname(char *name);
  61. /* Resolve an internet hostname, like gethostbyname
  62. * ------------------------------------------------
  63. *
  64. * On entry,
  65. * str points to the given host name, not numeric address,
  66. * without colon or port number.
  67. *
  68. * On exit,
  69. * returns a pointer to a struct hostent in static storage,
  70. * or NULL in case of error or user interruption.
  71. *
  72. * The interface is intended to be the same as for gethostbyname(),
  73. * but additional status is returned in lynx_nsl_status.
  74. */
  75. extern int lynx_nsl_status;
  76. extern struct hostent *LYGetHostByName(char *str);
  77. /* Get Name of This Machine
  78. * ------------------------
  79. *
  80. */
  81. extern const char *HTHostName(void);
  82. extern int HTDoConnect(const char *url,
  83. const char *protocol,
  84. int default_port,
  85. int *s);
  86. extern int HTDoRead(int fildes,
  87. void *buf,
  88. unsigned nbyte);
  89. #ifdef __cplusplus
  90. }
  91. #endif
  92. #endif /* HTTCP_H */