Annotation of libwww/Library/src/HTInet.html, revision 2.1
2.1 ! frystyk 1: <HTML>
! 2: <HEAD>
! 3: <TITLE>W3C Reference Library libwww Generic Network Communication</TITLE>
! 4: <!-- Changed by: Henrik Frystyk Nielsen, 27-Mar-1996 -->
! 5: </HEAD>
! 6: <BODY>
! 7:
! 8: <H1>Generic Network Communication</H1>
! 9:
! 10: <PRE>
! 11: /*
! 12: ** (c) COPYRIGHT MIT 1995.
! 13: ** Please first read the full copyright statement in the file COPYRIGH.
! 14: */
! 15: </PRE>
! 16:
! 17: This module has the common code for handling TCP/IP and DECnet connections
! 18: etc. The main topics of functions in this module are:
! 19:
! 20: <UL>
! 21: <LI><A HREF="#errormsg">Errno Messages</A>
! 22: <LI><A HREF="#DNS">Host and mail addresses</A>
! 23: <LI><A HREF="#Signals">Signal Handling</A>
! 24: </UL>
! 25:
! 26: This module is implemented by <A HREF="HTInet.c">HTInet.c</A>, and it is
! 27: a part of the <A HREF="http://www.w3.org/pub/WWW/Library/"> W3C
! 28: Reference Library</A>.
! 29:
! 30: <PRE>
! 31: #ifndef HTINET_H
! 32: #define HTINET_H
! 33: #include "HTReq.h"
! 34: #include "HTNet.h"
! 35: </PRE>
! 36:
! 37: <A NAME="errormsg"><H2>System Description of Error Message</H2></A>
! 38:
! 39: Return error message corresponding to errno number given. We need to
! 40: pass the error number as a parameter as we on some platforms get
! 41: different codes from sockets and local file access.
! 42:
! 43: <PRE>
! 44: extern const char * HTErrnoString (int errnum);
! 45: extern int HTInetStatus (int errnum, char * where);
! 46: </PRE>
! 47:
! 48: <H3>Parse a Cardinal Value</H3>
! 49:
! 50: <PRE>
! 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:
! 65: extern unsigned int HTCardinal (int * pstatus,
! 66: char ** pp,
! 67: unsigned int max_value);
! 68: </PRE>
! 69:
! 70: <A NAME="DNS"><H2>Internet Name Server Functions</H2></A>
! 71:
! 72: The following functions are available to get information about a
! 73: specified host.
! 74:
! 75: <H3>Produce a string for an internet address</H3>
! 76:
! 77: This function is equivalent to the BSD system call <B>inet_ntoa</B> in that it
! 78: converts a numeric 32-bit IP-address to a dotted-notation decimal string. The
! 79: pointer returned points to static memory which must be copied if it is to be
! 80: kept.
! 81:
! 82: <PRE>
! 83: extern const char * HTInetString (struct sockaddr_in * sin);
! 84: </PRE>
! 85:
! 86: <H3>Parse a network node address and port</H3>
! 87:
! 88: It is assumed that any portnumber and numeric host address is given in
! 89: decimal notation. Separation character is '.' Any port number given
! 90: in host name overrides all other values. 'host' might be modified.
! 91:
! 92: <PRE>
! 93: extern int HTParseInet (HTNet * net, char * host);
! 94: </PRE>
! 95:
! 96: <A NAME="HTGetHostName"><H3>Get Name of This Machine</H3></A>
! 97:
! 98: This function returns a CONET char pointer to a static location containing
! 99: the name of this host or NULL if not available.
! 100:
! 101: <PRE>
! 102: extern const char * HTGetHostName (void);
! 103: </PRE>
! 104:
! 105:
! 106: <H3>Set Name of This Machine</H3>
! 107:
! 108: This function overwrites any other value of current host name. This might
! 109: be set by the user to change the value in the ID value parsed to a news host
! 110: when posting. The change doesn't influence the <A HREF="HTInet.html#Mailaddress">Mail Address</A> as they are stored in two different locations. If, however,
! 111: the change is done before the first call to HTGetMailAddress() then this
! 112: function will use the new host and domain name.
! 113:
! 114: <PRE>
! 115: extern void HTSetHostName (char * host);
! 116: </PRE>
! 117:
! 118: <H3>Cleanup Memory</H3>
! 119:
! 120: Called from <A HREF="HTReq.html#Library">HTLibTerminate</A>
! 121:
! 122: <PRE>
! 123: extern void HTFreeHostName (void);
! 124: </PRE>
! 125:
! 126: <H3>Get Domain Name of This Machine</H3>
! 127:
! 128: This function rerturns the domain name part of the host name as returned by
! 129: HTGetHostName() function. Changing the domain name requires a call to
! 130: HTSetHostname().
! 131:
! 132: <PRE>
! 133: extern const char *HTGetDomainName (void);
! 134: </PRE>
! 135:
! 136:
! 137: <A NAME="Mailaddress"><H3>Get User Mail Address</H3></A>
! 138:
! 139: This functions returns a char pointer to a static location containing
! 140: the mail address of the current user. The static location is different
! 141: from the one of the current host name so different values can be
! 142: assigned. The default value is <USER>@hostname where hostname is
! 143: as returned by HTGetHostName().
! 144:
! 145: <PRE>
! 146: #ifndef HT_DEFAULT_LOGIN
! 147: #define HT_DEFAULT_LOGIN "libwww"
! 148: #endif
! 149:
! 150: extern const char * HTGetMailAddress (void);
! 151: </PRE>
! 152:
! 153:
! 154: <H3>Set User Mail Address</H3>
! 155:
! 156: This function overwrites any other value of current mail address. This
! 157: might be set by the user to change the value in the <A
! 158: HREF="http://www.w3.org/pub/WWW/Protocols/HTTP/HTRQ_Headers.html#from">
! 159: From field</A> in the <A
! 160: HREF="http://www.w3.org/pub/WWW/Protocols/HTTP/HTTP2.html">HTTP
! 161: Protocol</A>.
! 162:
! 163: <PRE>
! 164: extern void HTSetMailAddress (char * address);
! 165: </PRE>
! 166:
! 167: <H3>Free Memory</H3>
! 168:
! 169: Called by <A HREF="HTReq.html#Library">HTLibTerminate</A>
! 170:
! 171: <PRE>
! 172: extern void HTFreeMailAddress (void);
! 173: </PRE>
! 174:
! 175: <H2>Signal Handling</H2>
! 176:
! 177: This is only necessary to compile on a few platforms and only if the
! 178: application does not have its own signal handling. It is required on
! 179: Solaris 2.3 (and other SVR4 platforms?) due to a bug in the TCP
! 180: kernel. When a <CODE>connect()</CODE> is tried to a illegal port,
! 181: solaris gives a SIGPIPE signal instead of returning <EM>Connection
! 182: refused</EM>.
! 183:
! 184: <PRE>
! 185: #ifdef WWWLIB_SIG
! 186: extern void HTSetSignal (void);
! 187: #endif
! 188:
! 189: #endif /* HTINET_H */
! 190: </PRE>
! 191:
! 192: <HR>
! 193: <ADDRESS>
! 194: @(#) $Id: Date Author State $
! 195: </ADDRESS>
! 196: </BODY>
! 197: </HTML>
Webmaster