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

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.5.2.2 ! frystyk    31: <H3>
2.2       frystyk    32:   System Description of Error Message
2.5.2.2 ! 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.5.2.2 ! frystyk    42: <H3>
2.2       frystyk    43:   Parse a Cardinal Value
2.5.2.2 ! 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.5.2.2 ! frystyk    55: <H3>
2.2       frystyk    56:   Produce a string for an internet address
2.5.2.2 ! 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.5.2.2 ! frystyk    66: <H3>
2.2       frystyk    67:   Parse a network node address and port
2.5.2.2 ! 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.5.2.1   eric       74: extern int HTParseInet (HTHost * host, char * hostname, HTRequest * request);
2.1       frystyk    75: </PRE>
2.5.2.2 ! frystyk    76: <H3>
2.2       frystyk    77:   Timezone Offset
2.5.2.2 ! 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.5.2.2 ! frystyk    84: <H3>
        !            85:   Get Time of day in Milli Seconds
        !            86: </H3>
        !            87: <P>
        !            88: Return the time of day in milli seconds.
        !            89: <PRE>extern int HTGetTimeInMillis (void);
        !            90: </PRE>
        !            91: <H3>
2.2       frystyk    92:   FQDN of this Host
2.5.2.2 ! 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.5.2.2 ! frystyk   100: <H3>
2.2       frystyk   101:   User Email Address
2.5.2.2 ! 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>&lt;USER&gt;@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.5.2.2 ! frystyk   116: <H3>
2.2       frystyk   117:   News server
2.5.2.2 ! 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.5.2.2 ! frystyk   123: <H3>
2.3       frystyk   124:   Get a Temporary File Name
2.5.2.2 ! frystyk   125: </H3>
2.3       frystyk   126: <P>
2.5       frystyk   127: Finds a temporary name in in the directory given. If the directory is
                    128: <CODE>NULL</CODE> do not prepend anything. If success, the result must be
                    129: freed by caller, else we return <CODE>NULL</CODE>
2.3       frystyk   130: <PRE>extern char * HTGetTmpFileName (const char * dir);
                    131: </PRE>
2.5.2.2 ! frystyk   132: <H3>
2.2       frystyk   133:   Signal Handling
2.5.2.2 ! frystyk   134: </H3>
2.2       frystyk   135: <P>
                    136: This is only necessary to compile on a few platforms and only if the application
                    137: does not have its own signal handling. It is required on Solaris 2.3 (and
                    138: other SVR4 platforms?) due to a bug in the TCP kernel. When a
                    139: <CODE>connect()</CODE> is tried to a illegal port, solaris gives a SIGPIPE
                    140: signal instead of returning <EM>Connection refused</EM>.
2.1       frystyk   141: <PRE>
                    142: #ifdef WWWLIB_SIG
                    143: extern void HTSetSignal (void);
                    144: #endif
                    145: 
                    146: #endif   /* HTINET_H */
                    147: </PRE>
2.2       frystyk   148: <P>
                    149:   <HR>
2.1       frystyk   150: <ADDRESS>
2.5.2.2 ! frystyk   151:   @(#) $Id: HTInet.html,v 2.5.2.1 1996/10/29 21:27:42 eric Exp $
2.1       frystyk   152: </ADDRESS>
2.2       frystyk   153: </BODY></HTML>

Webmaster