Annotation of libwww/Library/src/HTTCP.html, revision 2.8

2.2       timbl       1: <HEADER>
                      2: <TITLE>/Net/dxcern/userd/timbl/hypertext/WWW/Library/src/HTTCP.html</TITLE></HEADER>
                      3: <BODY>
                      4: <H1>Generic TCP/IP Communication</H1>This module has the common code for
                      5: handling TCP/IP connections etc.
2.8     ! frystyk     6: <PRE>
        !             7: #ifndef HTTCP_H
2.2       timbl       8: #define HTTCP_H
                      9: 
2.8     ! frystyk    10: #include "tcp.h"
        !            11: 
2.2       timbl      12: #include "HTUtils.h"
2.8     ! frystyk    13: #include "HTAccess.h"
2.1       timbl      14: 
                     15: #ifdef SHORT_NAMES
                     16: #define HTInetStatus           HTInStat
                     17: #define HTInetString           HTInStri
                     18: #define HTParseInet            HTPaInet
                     19: #endif
2.8     ! frystyk    20: </PRE>
        !            21: 
        !            22: <H2>Connection Management</H2>
        !            23: 
        !            24: Theese functions handle access to the net.
        !            25: 
        !            26: <H3>Active Connection Establishment</H3>
        !            27: 
        !            28: This makes an active connect to the specified host. The request structure is
        !            29: parsed in order to handle errors. Default port might be overwritten by any
        !            30: port indication in the URL specified as &lt;host&gt;:&lt;port&gt; If it is
        !            31: a multihomed host then HTDoConnect measures the time to do the connection and
        !            32: updates the calculated weights in the cache of visited hosts. 
        !            33: 
        !            34: <PRE>
        !            35: extern int HTDoConnect PARAMS((        HTRequest       *request,
        !            36:                                char            *url,
        !            37:                                u_short         default_port,
        !            38:                                int             *sockfd,
        !            39:                                u_long          *addr));
        !            40: </PRE>
        !            41: 
        !            42: 
        !            43: <H3>Passive Connection Establishment</H3>
        !            44: 
        !            45: This function makes a non-blocking accept on a port and polls every second
        !            46: until MAX_ACCEPT_POLL or interrupted by user.
2.1       timbl      47: 
2.8     ! frystyk    48: <PRE>
        !            49: extern int HTDoAccept PARAMS((HTRequest *request, int sockfd));
        !            50: </PRE>
2.1       timbl      51: 
2.8     ! frystyk    52: <H2>Caching Hosts</H2>
        !            53: 
        !            54: This is mainly an internal matter to the HTTCP.c module but it keeps a
        !            55: cache of all visited hosts so that we don't have to consult the DNS every
        !            56: time. One public function is HTTCPAddrWeights(). It updates the calculated
        !            57: weights on the time it takes to sestablish a connection.
        !            58: 
        !            59: <PRE>
        !            60: extern void HTTCPAddrWeights PARAMS((char * host, time_t deltatime));
        !            61: </PRE>
        !            62: 
        !            63: 
        !            64: <H2>Errors and status indications</H2>
        !            65: 
        !            66: Theese functions return an explanation if an error has occured.
        !            67: 
        !            68: <H3>Errno Message</H3>
2.7       luotonen   69: 
2.8     ! frystyk    70: Return error message corresponding to current errno, just like strerror().
2.7       luotonen   71: 
2.8     ! frystyk    72: <PRE>
        !            73: extern CONST char * HTErrnoString NOPARAMS;
        !            74: </PRE>
2.1       timbl      75: 
2.8     ! frystyk    76: <H3>Description of what Caused the Error</H3>
2.1       timbl      77: 
2.8     ! frystyk    78: The parameter `where' gives a description of what caused the error, often
        !            79: the name of a system call. <P>
2.7       luotonen   80: 
2.8     ! frystyk    81: This function should only rarely be called directly. Instead the common error
        !            82: function HTErrorAdd() should be used as then the error is parsed all the way
        !            83: to the user. The function returns a negative status in the unix way.
2.1       timbl      84: 
2.8     ! frystyk    85: <PRE>
        !            86: extern int HTInetStatus PARAMS((char * where));
        !            87: </PRE>
2.1       timbl      88: 
2.8     ! frystyk    89: <PRE>
2.1       timbl      90: /*     Parse a cardinal value                                 parse_cardinal()
                     91: **     ----------------------
                     92: **
                     93: ** On entry:
                     94: **     *pp points to first character to be interpreted, terminated by
                     95: **     non 0..9 character.
                     96: **     *pstatus points to status already valid,
                     97: **     maxvalue gives the largest allowable value.
                     98: **
                     99: ** On exit:
                    100: **     *pp points to first unread character,
                    101: **     *pstatus points to status updated iff bad
                    102: */
2.2       timbl     103: 
2.7       luotonen  104: PUBLIC unsigned int HTCardinal PARAMS((int *           pstatus,
                    105:                                       char **          pp,
                    106:                                       unsigned int     max_value));
2.8     ! frystyk   107: </PRE>
        !           108: 
        !           109: <H2>Internet Name Server Functions</H2>
        !           110: 
        !           111: The following functions are available to get information about a
        !           112: specified host.
        !           113: 
        !           114: <H3>Produce a string for an internet address</H3>
        !           115: 
        !           116: This function is equivalent to the BSD system call <B>inet_ntoa</B> in that it
        !           117: converts a numeric 32-bit IP-address to a dotted-notation decimal string. The
        !           118: pointer returned points to static memory which must be copied if it is to be
        !           119: kept.
        !           120: 
        !           121: <PRE>
        !           122: extern CONST char * HTInetString PARAMS((struct sockaddr_in * sin));
        !           123: </PRE>
        !           124: 
        !           125: <H3>Parse an internet node address and port</H3>
        !           126: 
        !           127: This function finds the address of a specified host and fills out the sockaddr
        !           128: structure. str points to a string with a node name or number, with optional
        !           129: trailing colon and port number. sin points to the binary internet or decnet
        !           130: address field. <P>
        !           131: 
        !           132: On exit *sin is filled in. If no port is specified in str, that field is left
        !           133: unchanged in *sin. If it is a multihomed host then multihomed is returned as
        !           134: YES. This is used for knowing when to measure the setup time for a connection
        !           135: in order to use the fastest IP-address on the multihomed host.
        !           136: <PRE>
        !           137: extern int HTParseInet PARAMS((struct sockaddr_in *    sin,
        !           138:                               CONST char *             str,
        !           139:                               BOOL *                   multihomed));
        !           140: </PRE>
        !           141: 
        !           142: <H3>Name of a Machine on the Other Side of a Socket</H3>
2.2       timbl     143: 
2.8     ! frystyk   144: This function should have been called HTGetHostByAddr but for historical
        !           145: reasons this is not the case.
2.1       timbl     146: 
2.8     ! frystyk   147: <PRE>
        !           148: extern char * HTGetHostName PARAMS((int soc));
        !           149: </PRE>
        !           150: 
        !           151: <H3>Host address retuned for specified host name</H3>
        !           152: 
        !           153: This function gets the address of the host and puts it in to the socket
        !           154: structure. It maintains its own cache of connections so that the communication
        !           155: to the Domain Name Server is minimized. If it is a multihomed host, then 
        !           156: `multi' is set to YES.
        !           157: 
        !           158: <PRE>
        !           159: extern char * HTGetHostByName PARAMS((char *host, SockA *sin, BOOL *multi));
        !           160: </PRE>
2.7       luotonen  161: 
2.1       timbl     162: 
2.8     ! frystyk   163: <H3>Get Name of This Machine</H3>
2.6       luotonen  164: 
2.8     ! frystyk   165: This functions a char pointer to a static location containing the name of this
        !           166: host.
2.7       luotonen  167: 
2.8     ! frystyk   168: <PRE>
        !           169: extern CONST char * HTHostName NOPARAMS;
        !           170: </PRE>
2.2       timbl     171: 
2.8     ! frystyk   172: <PRE>
2.2       timbl     173: #endif   /* HTTCP_H */
2.8     ! frystyk   174: </PRE>
        !           175: End of file
        !           176: </BODY>
        !           177: </HTML>

Webmaster