Merge branch 'master' of https://git.maemo.org/projects/erwise
[erwise] / Cl / WWWLibrary / HTTCP.h
1 /*                      Generic Communication Code              HTTCP.h
2 **                      ==========================
3 **
4 */
5 #include "tcp.h"
6
7 #ifdef SHORT_NAMES
8 #define HTInetStatus            HTInStat
9 #define HTInetString            HTInStri
10 #define HTParseInet             HTPaInet
11 #endif
12
13
14 /*      Produce a string for an internet address
15 **      ---------------------------------------
16 **
17 ** On exit,
18 **      returns a pointer to a static string which must be copied if
19 **              it is to be kept.
20 */
21 #ifdef __STDC__
22 extern const char * HTInetString(struct sockaddr_in* sin);
23 #else
24 extern char * HTInetString();
25 #endif
26
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 #ifdef __STDC__
39 extern int HTInetStatus(char *where);
40 #else
41 extern int HTInetStatus();
42 #endif
43
44 /*      Publicly accesible variables
45 */
46 /* extern struct sockaddr_in HTHostAddress; */
47                         /* The internet address of the host */
48                         /* Valid after call to HTHostName() */
49
50
51 /*      Parse a cardinal value                                 parse_cardinal()
52 **      ----------------------
53 **
54 ** On entry,
55 **      *pp         points to first character to be interpreted, terminated by
56 **                  non 0:9 character.
57 **      *pstatus    points to status already valid
58 **      maxvalue    gives the largest allowable value.
59 **
60 ** On exit,
61 **      *pp         points to first unread character
62 **      *pstatus    points to status updated iff bad
63 */
64 #ifdef __STDC__
65 extern unsigned int HTCardinal(int *pstatus,
66         char            **pp,
67         unsigned int    max_value);
68 #else
69 extern unsigned int HTCardinal();
70 #endif
71
72 /*      Parse an internet node address and port
73 **      ---------------------------------------
74 **
75 ** On entry,
76 **      str     points to a string with a node name or number,
77 **              with optional trailing colon and port number.
78 **      sin     points to the binary internet address field.
79 **
80 ** On exit,
81 **      *sin    is filled in. If no port is specified in str, that
82 **              field is left unchanged in *sin.
83 */
84 #ifdef __STDC__
85 extern int HTParseInet(struct sockaddr_in* sin, const char *str);
86 #else
87 extern int HTParseInet();
88 #endif
89
90 /*      Get Name of This Machine
91 **      ------------------------
92 **
93 */
94 #ifdef __STDC__
95 extern const char * HTHostName(void);
96 #else
97 extern char * HTHostName();
98 #endif