Annotation of libwww/Library/src/HTInet.html, revision 2.11

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

Webmaster