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

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.12    ! vbancrof   28: 
        !            29: #ifdef __cplusplus
        !            30: extern "C" { 
        !            31: #endif 
2.1       frystyk    32: </PRE>
2.6       frystyk    33: <H3>
2.2       frystyk    34:   System Description of Error Message
2.6       frystyk    35: </H3>
2.2       frystyk    36: <P>
                     37: Return error message corresponding to errno number given. We need to pass
                     38: the error number as a parameter as we on some platforms get different codes
                     39: from sockets and local file access.
2.1       frystyk    40: <PRE>
2.11      frystyk    41: extern char * HTErrnoString    (int errnum);
                     42: extern int HTInetStatus                (int errnum, char * where);
2.1       frystyk    43: </PRE>
2.6       frystyk    44: <H3>
2.2       frystyk    45:   Parse a Cardinal Value
2.6       frystyk    46: </H3>
2.2       frystyk    47: <P>
                     48: Converts a string to a cardinal value. On entry: *pp points to first character
                     49: to be interpreted, terminated by non 0..9 character. *pstatus points to status
                     50: already valid, maxvalue gives the largest allowable value. On exit: *pp points
                     51: to first unread character, *pstatus points to status updated iff bad
2.1       frystyk    52: <PRE>
                     53: extern unsigned int HTCardinal (int *          pstatus,
                     54:                                char **         pp,
                     55:                                unsigned int    max_value);
                     56: </PRE>
2.6       frystyk    57: <H3>
2.2       frystyk    58:   Produce a string for an internet address
2.6       frystyk    59: </H3>
2.2       frystyk    60: <P>
                     61: This function is equivalent to the BSD system call <B>inet_ntoa</B> in that
                     62: it converts a numeric 32-bit IP-address to a dotted-notation decimal string.
                     63: The pointer returned points to static memory which must be copied if it is
                     64: to be kept.
2.1       frystyk    65: <PRE>
                     66: extern const char * HTInetString (struct sockaddr_in * sin);
                     67: </PRE>
2.6       frystyk    68: <H3>
2.2       frystyk    69:   Parse a network node address and port
2.6       frystyk    70: </H3>
2.2       frystyk    71: <P>
                     72: It is assumed that any portnumber and numeric host address is given in decimal
                     73: notation. Separation character is '.' Any port number given in host name
                     74: overrides all other values. 'host' might be modified.
2.1       frystyk    75: <PRE>
2.6       frystyk    76: extern int HTParseInet (HTHost * host, char * hostname, HTRequest * request);
2.1       frystyk    77: </PRE>
2.6       frystyk    78: <H3>
2.2       frystyk    79:   Timezone Offset
2.6       frystyk    80: </H3>
2.2       frystyk    81: <P>
                     82: Calculates the offset from GMT in <I>seconds</I>.
                     83: <PRE>
                     84: extern time_t HTGetTimeZoneOffset (void);
                     85: </PRE>
2.6       frystyk    86: <H3>
                     87:   Get Time of day in Milli Seconds
                     88: </H3>
                     89: <P>
                     90: Return the time of day in milli seconds.
2.7       frystyk    91: <PRE>extern ms_t HTGetTimeInMillis (void);
2.6       frystyk    92: </PRE>
                     93: <H3>
2.2       frystyk    94:   FQDN of this Host
2.6       frystyk    95: </H3>
2.2       frystyk    96: <P>
                     97: This function returns a the name of this host or NULL if not available. The
                     98: name is stored in a static variable.
                     99: <PRE>
                    100: extern char * HTGetHostName (void);
                    101: </PRE>
2.6       frystyk   102: <H3>
2.2       frystyk   103:   User Email Address
2.6       frystyk   104: </H3>
2.2       frystyk   105: <P>
                    106: This functions returns a char pointer to a static location containing the
                    107: mail address of the current user. The static location is different from the
                    108: one of the current host name so different values can be assigned. The default
                    109: value is <CODE>&lt;USER&gt;@hostname</CODE> where hostname is as returned
                    110: by <I>HTGetHostName()</I>.
2.1       frystyk   111: <PRE>
                    112: #ifndef HT_DEFAULT_LOGIN
                    113: #define HT_DEFAULT_LOGIN       "libwww"
                    114: #endif
                    115: 
2.2       frystyk   116: extern char * HTGetMailAddress (void);
2.1       frystyk   117: </PRE>
2.6       frystyk   118: <H3>
2.2       frystyk   119:   News server
2.6       frystyk   120: </H3>
2.2       frystyk   121: <P>
                    122: The default news host is "news" but you can get ans set the value here.
                    123: <PRE>extern char * HTGetNewsServer (void);
                    124: </PRE>
2.6       frystyk   125: <H3>
2.3       frystyk   126:   Get a Temporary File Name
2.6       frystyk   127: </H3>
2.3       frystyk   128: <P>
2.11      frystyk   129: HTGetTmpFileName() allows the user to control the choice of a directory.
                    130: The argument dir points to the name of the directory in which the file is
                    131: to be created. This is equivalent to tempnam() function.
2.9       frystyk   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: 
2.12    ! vbancrof  149: #ifdef __cplusplus
        !           150: }
        !           151: #endif
        !           152: 
2.1       frystyk   153: #endif   /* HTINET_H */
                    154: </PRE>
2.2       frystyk   155: <P>
                    156:   <HR>
2.1       frystyk   157: <ADDRESS>
2.12    ! vbancrof  158:   @(#) $Id: HTInet.html,v 2.11 1998/09/22 23:56:01 frystyk Exp $
2.1       frystyk   159: </ADDRESS>
2.2       frystyk   160: </BODY></HTML>

Webmaster