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