Annotation of libwww/Library/src/HTInet.html, revision 2.9
2.1 frystyk 1: <HTML>
2: <HEAD>
2.4 frystyk 3: <!-- Changed by: Henrik Frystyk Nielsen, 15-Jul-1996 -->
2.8 frystyk 4: <TITLE>W3C Sample Code 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.8 frystyk 23: a part of the <A HREF="http://www.w3.org/pub/WWW/Library/">W3C Sample Code
2.2 frystyk 24: Library</A>.
2.1 frystyk 25: <PRE>
26: #ifndef HTINET_H
27: #define HTINET_H
28: #include "HTReq.h"
2.6 frystyk 29: #include "HTHstMan.h"
2.1 frystyk 30: </PRE>
2.6 frystyk 31: <H3>
2.2 frystyk 32: System Description of Error Message
2.6 frystyk 33: </H3>
2.2 frystyk 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.6 frystyk 42: <H3>
2.2 frystyk 43: Parse a Cardinal Value
2.6 frystyk 44: </H3>
2.2 frystyk 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.6 frystyk 55: <H3>
2.2 frystyk 56: Produce a string for an internet address
2.6 frystyk 57: </H3>
2.2 frystyk 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.6 frystyk 66: <H3>
2.2 frystyk 67: Parse a network node address and port
2.6 frystyk 68: </H3>
2.2 frystyk 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.6 frystyk 74: extern int HTParseInet (HTHost * host, char * hostname, HTRequest * request);
2.1 frystyk 75: </PRE>
2.6 frystyk 76: <H3>
2.2 frystyk 77: Timezone Offset
2.6 frystyk 78: </H3>
2.2 frystyk 79: <P>
80: Calculates the offset from GMT in <I>seconds</I>.
81: <PRE>
82: extern time_t HTGetTimeZoneOffset (void);
83: </PRE>
2.6 frystyk 84: <H3>
85: Get Time of day in Milli Seconds
86: </H3>
87: <P>
88: Return the time of day in milli seconds.
2.7 frystyk 89: <PRE>extern ms_t HTGetTimeInMillis (void);
2.6 frystyk 90: </PRE>
91: <H3>
2.2 frystyk 92: FQDN of this Host
2.6 frystyk 93: </H3>
2.2 frystyk 94: <P>
95: This function returns a the name of this host or NULL if not available. The
96: name is stored in a static variable.
97: <PRE>
98: extern char * HTGetHostName (void);
99: </PRE>
2.6 frystyk 100: <H3>
2.2 frystyk 101: User Email Address
2.6 frystyk 102: </H3>
2.2 frystyk 103: <P>
104: This functions returns a char pointer to a static location containing the
105: mail address of the current user. The static location is different from the
106: one of the current host name so different values can be assigned. The default
107: value is <CODE><USER>@hostname</CODE> where hostname is as returned
108: by <I>HTGetHostName()</I>.
2.1 frystyk 109: <PRE>
110: #ifndef HT_DEFAULT_LOGIN
111: #define HT_DEFAULT_LOGIN "libwww"
112: #endif
113:
2.2 frystyk 114: extern char * HTGetMailAddress (void);
2.1 frystyk 115: </PRE>
2.6 frystyk 116: <H3>
2.2 frystyk 117: News server
2.6 frystyk 118: </H3>
2.2 frystyk 119: <P>
120: The default news host is "news" but you can get ans set the value here.
121: <PRE>extern char * HTGetNewsServer (void);
122: </PRE>
2.6 frystyk 123: <H3>
2.3 frystyk 124: Get a Temporary File Name
2.6 frystyk 125: </H3>
2.3 frystyk 126: <P>
2.9 ! frystyk 127: HTGetTmpFileName() allows the user to control the choice of a
! 128: directory. The argument dir points to the name of the directory in
! 129: which the file is to be created. This is equivalent to tempnam()
! 130: function.
! 131:
! 132: <PRE>
! 133: extern char * HTGetTmpFileName (const char * dir);
2.3 frystyk 134: </PRE>
2.6 frystyk 135: <H3>
2.2 frystyk 136: Signal Handling
2.6 frystyk 137: </H3>
2.2 frystyk 138: <P>
139: This is only necessary to compile on a few platforms and only if the application
140: does not have its own signal handling. It is required on Solaris 2.3 (and
141: other SVR4 platforms?) due to a bug in the TCP kernel. When a
142: <CODE>connect()</CODE> is tried to a illegal port, solaris gives a SIGPIPE
143: signal instead of returning <EM>Connection refused</EM>.
2.1 frystyk 144: <PRE>
145: #ifdef WWWLIB_SIG
146: extern void HTSetSignal (void);
147: #endif
148:
149: #endif /* HTINET_H */
150: </PRE>
2.2 frystyk 151: <P>
152: <HR>
2.1 frystyk 153: <ADDRESS>
2.9 ! frystyk 154: @(#) $Id: HTInet.html,v 2.8 1997/02/16 18:42:27 frystyk Exp $
2.1 frystyk 155: </ADDRESS>
2.2 frystyk 156: </BODY></HTML>
Webmaster