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