Annotation of libwww/Library/src/HTInet.html, revision 2.5.2.1
2.1 frystyk 1: <HTML>
2: <HEAD>
2.4 frystyk 3: <!-- Changed by: Henrik Frystyk Nielsen, 15-Jul-1996 -->
2.2 frystyk 4: <TITLE>W3C Reference Library libwww Generic Network Communication</TITLE>
2.1 frystyk 5: </HEAD>
6: <BODY>
2.2 frystyk 7: <H1>
8: Generic Network Communication
9: </H1>
2.1 frystyk 10: <PRE>
11: /*
12: ** (c) COPYRIGHT MIT 1995.
13: ** Please first read the full copyright statement in the file COPYRIGH.
14: */
15: </PRE>
2.2 frystyk 16: <P>
17: This module has the common code for handling typical Internet functions like
18: getting the name of the local host, getting the domain name and email address
19: of user, parsing error codes returned in <CODE>errno</CODE> or equivalent
20: etc.
21: <P>
2.1 frystyk 22: This module is implemented by <A HREF="HTInet.c">HTInet.c</A>, and it is
2.2 frystyk 23: a part of the <A HREF="http://www.w3.org/pub/WWW/Library/">W3C Reference
24: Library</A>.
2.1 frystyk 25: <PRE>
26: #ifndef HTINET_H
27: #define HTINET_H
28: #include "HTReq.h"
2.5.2.1 ! eric 29: #include "HTHstMan.h"
2.1 frystyk 30: </PRE>
2.2 frystyk 31: <H2>
32: System Description of Error Message
33: </H2>
34: <P>
35: Return error message corresponding to errno number given. We need to pass
36: the error number as a parameter as we on some platforms get different codes
37: from sockets and local file access.
2.1 frystyk 38: <PRE>
39: extern const char * HTErrnoString (int errnum);
40: extern int HTInetStatus (int errnum, char * where);
41: </PRE>
2.2 frystyk 42: <H2>
43: Parse a Cardinal Value
44: </H2>
45: <P>
46: Converts a string to a cardinal value. On entry: *pp points to first character
47: to be interpreted, terminated by non 0..9 character. *pstatus points to status
48: already valid, maxvalue gives the largest allowable value. On exit: *pp points
49: to first unread character, *pstatus points to status updated iff bad
2.1 frystyk 50: <PRE>
51: extern unsigned int HTCardinal (int * pstatus,
52: char ** pp,
53: unsigned int max_value);
54: </PRE>
2.2 frystyk 55: <H2>
56: Produce a string for an internet address
57: </H2>
58: <P>
59: This function is equivalent to the BSD system call <B>inet_ntoa</B> in that
60: it converts a numeric 32-bit IP-address to a dotted-notation decimal string.
61: The pointer returned points to static memory which must be copied if it is
62: to be kept.
2.1 frystyk 63: <PRE>
64: extern const char * HTInetString (struct sockaddr_in * sin);
65: </PRE>
2.2 frystyk 66: <H2>
67: Parse a network node address and port
68: </H2>
69: <P>
70: It is assumed that any portnumber and numeric host address is given in decimal
71: notation. Separation character is '.' Any port number given in host name
72: overrides all other values. 'host' might be modified.
2.1 frystyk 73: <PRE>
2.5.2.1 ! eric 74: extern int HTParseInet (HTHost * host, char * hostname, HTRequest * request);
2.1 frystyk 75: </PRE>
2.2 frystyk 76: <H2>
77: Timezone Offset
78: </H2>
79: <P>
80: Calculates the offset from GMT in <I>seconds</I>.
81: <PRE>
82: extern time_t HTGetTimeZoneOffset (void);
83: </PRE>
84: <H2>
85: FQDN of this Host
86: </H2>
87: <P>
88: This function returns a the name of this host or NULL if not available. The
89: name is stored in a static variable.
90: <PRE>
91: extern char * HTGetHostName (void);
92: </PRE>
93: <H2>
94: User Email Address
95: </H2>
96: <P>
97: This functions returns a char pointer to a static location containing the
98: mail address of the current user. The static location is different from the
99: one of the current host name so different values can be assigned. The default
100: value is <CODE><USER>@hostname</CODE> where hostname is as returned
101: by <I>HTGetHostName()</I>.
2.1 frystyk 102: <PRE>
103: #ifndef HT_DEFAULT_LOGIN
104: #define HT_DEFAULT_LOGIN "libwww"
105: #endif
106:
2.2 frystyk 107: extern char * HTGetMailAddress (void);
2.1 frystyk 108: </PRE>
2.2 frystyk 109: <H2>
110: News server
111: </H2>
112: <P>
113: The default news host is "news" but you can get ans set the value here.
114: <PRE>extern char * HTGetNewsServer (void);
115: </PRE>
116: <H2>
2.3 frystyk 117: Get a Temporary File Name
118: </H2>
119: <P>
2.5 frystyk 120: Finds a temporary name in in the directory given. If the directory is
121: <CODE>NULL</CODE> do not prepend anything. If success, the result must be
122: freed by caller, else we return <CODE>NULL</CODE>
2.3 frystyk 123: <PRE>extern char * HTGetTmpFileName (const char * dir);
124: </PRE>
125: <H2>
2.2 frystyk 126: Signal Handling
127: </H2>
128: <P>
129: This is only necessary to compile on a few platforms and only if the application
130: does not have its own signal handling. It is required on Solaris 2.3 (and
131: other SVR4 platforms?) due to a bug in the TCP kernel. When a
132: <CODE>connect()</CODE> is tried to a illegal port, solaris gives a SIGPIPE
133: signal instead of returning <EM>Connection refused</EM>.
2.1 frystyk 134: <PRE>
135: #ifdef WWWLIB_SIG
136: extern void HTSetSignal (void);
137: #endif
138:
139: #endif /* HTINET_H */
140: </PRE>
2.2 frystyk 141: <P>
142: <HR>
2.1 frystyk 143: <ADDRESS>
2.5.2.1 ! eric 144: @(#) $Id: HTInet.html,v 2.5 1996/09/08 22:08:23 frystyk Exp $
2.1 frystyk 145: </ADDRESS>
2.2 frystyk 146: </BODY></HTML>
Webmaster