Annotation of libwww/Library/src/HTNet.html, revision 2.44.2.5

2.1       frystyk     1: <HTML>
                      2: <HEAD>
2.43      frystyk     3:   <TITLE>W3C Reference Library libwww HTNet Class</TITLE>
2.1       frystyk     4: </HEAD>
                      5: <BODY>
2.43      frystyk     6: <H1>
                      7:   The Net Class
2.36      eric        8: </H1>
2.5       frystyk     9: <PRE>
                     10: /*
2.8       frystyk    11: **     (c) COPYRIGHT MIT 1995.
2.5       frystyk    12: **     Please first read the full copyright statement in the file COPYRIGH.
                     13: */
                     14: </PRE>
2.36      eric       15: <P>
2.38      frystyk    16: The Net class manages information related to a "thread" in libwww. As libwww
                     17: threads are not really threads but a notion of using interleaved, non-blocking
                     18: I/O for accessing data objects from the network (or local file system), they
                     19: can be used on any platform with or without support for native threads. In
                     20: the case where you have an application using real threads the Net class is
                     21: simply a object maintaining links to all other objects involved in serving
                     22: the request. If you are using the libwww pseudo threads then the Net object
                     23: contains enough information to stop and start a request based on which BSD
                     24: sockets are ready. In practise this is of course transparent to the application
                     25: - this is just to explain the difference.
                     26: <P>
                     27: When a <A HREF="HTReq.html">Request object</A> is passed to the Library ,
                     28: the core creates a new HTNet object pr <A HREF="HTChannl.html">channel</A>
                     29: used by the request. In many cases a request only uses a single
                     30: <A HREF="HTChannl.html">channel object </A>but for example FTP requests use
                     31: at least two - one for the control connection and one for the data connection.
                     32: <P>
                     33: You can find more information about the libwww pseudo thread model in the
                     34: <A HREF="../User/Architecture/"> Multithread Specifications</A>.
2.36      eric       35: <P>
                     36: This module is implemented by <A HREF="HTNet.c">HTNet.c</A>, and it is a
                     37: part of the <A HREF="http://www.w3.org/pub/WWW/Library/">W3C Reference
                     38: Library</A>.
2.1       frystyk    39: <PRE>
2.17      frystyk    40: #ifndef HTNET_H
                     41: #define HTNET_H
2.1       frystyk    42: </PRE>
2.36      eric       43: <P>
                     44: The <CODE>HTNet</CODE> object is the core of the request queue management.
                     45: This object contains information about the socket descriptor, the input read
                     46: buffer etc. required to identify and service a request.
2.1       frystyk    47: <PRE>
2.18      frystyk    48: typedef struct _HTNet HTNet;
2.34      frystyk    49: 
2.36      eric       50: #include "HTEvent.h"
2.34      frystyk    51: #include "HTReq.h"
2.44      frystyk    52: #include "HTResponse.h"
2.34      frystyk    53: #include "HTTrans.h"
                     54: #include "HTHost.h"
2.44.2.3  frystyk    55: #include "HTProt.h"
2.34      frystyk    56: #include "HTChannl.h"
                     57: #include "HTDNS.h"
2.1       frystyk    58: </PRE>
2.36      eric       59: <H2>
2.44      frystyk    60:   <A NAME="callout">Generic BEFORE and AFTER Filter Management</A>
2.36      eric       61: </H2>
                     62: <P>
2.43      frystyk    63: Filter functions can be registered to be called <EM>before</EM> and
2.44      frystyk    64: <EM>after</EM> a request has either been started or has terminated. The
                     65: conditions for <I>BEFORE</I> and <I>AFTER</I> filters are not the same so
                     66: we maintain them independently. Filters can be registered globally or locally.
                     67: The global filters are registered directly by the Net Object (this module)
                     68: and the local filters are registered by the
                     69: <A HREF="HTReq.html">HTRequest</A> Object. However, both &nbsp;local and
                     70: global filters use the same regisration mechanism which we provide here.
                     71: <H3>
                     72:   Filter Ordering
                     73: </H3>
                     74: <P>
                     75: Filters can be registered by anyone and as they are an often used mechanism
                     76: for introducing extensions in libwww, they are videly used to handle
                     77: authentication, redirection, etc. Many filters can be registered at once
                     78: and not all of the filters may know about the other filters. Therefore, it
                     79: is difficult to specify an absolute ordering by which the filters should
                     80: be called. Instead you can decide a relative order by which the filters should
                     81: be called. The order works pretty much like the Unix priority mechanism running
                     82: from <CODE>HT_FILTER_FIRST</CODE> to <CODE>HT_FILTER_LAST</CODE> having
                     83: <CODE>HT_FILTER_MIDDLE</CODE> being the "normal" case.
                     84: <PRE>
                     85: #define HT_FILTER_FIRST                0
                     86: #define HT_FILTER_MIDDLE       5
                     87: #define HT_FILTER_LAST         10
                     88: </PRE>
                     89: <P>
                     90: In case multiple filters are registered with the same order then they are
                     91: called in the <I>inverse</I> order they were registered.&nbsp;
                     92: <H3>
                     93:   Filter URL Templates
                     94: </H3>
                     95: <P>
                     96: Both <I>BEFORE</I> and <I>AFTER</I> filters can be registered with a <I>URL
                     97: template</I> in which case they are only called when the <I>Request URL</I>
                     98: matches the template. A template is simply a string which is matched against
                     99: the <I>Request URL</I>. The string can be terminated by a&nbsp;single
                    100: "<CODE>*</CODE>" in which case all strings matching the template up til the
                    101: "*" is considered a match. A template can be as short as the access scheme
                    102: which enmables a filter for a specific access method only, for example
                    103: "<CODE>http//&lt;star&gt;</CODE>".
                    104: <H3>
                    105:   BEFORE Filters
                    106: </H3>
                    107: <P>
                    108: A <I>BEFORE</I> filter is called whenever we issue a request and they have
                    109: been selected by the execution procedure. <I>BEFORE</I> filters are registered
                    110: with a <I>context</I> and a <I>filter order</I> by which they are to be called
                    111: and a <I>URL template</I> which may be NULL. In this case, the filter is
                    112: called on every request. The mode can be used by anybody to pass an extra
                    113: parameter to a filter. This is not really OO thinking - but hey - this is C ;-)
                    114: <PRE>typedef int HTNetBefore (HTRequest * request, void * param, int mode);
                    115: </PRE>
                    116: <P>
                    117: You can add a <I>BEFORE</I> filter in the list provided by the caller. Several
                    118: filters can be registered in which case they are called with the filter ordering
                    119: in mind.
                    120: <PRE>
                    121: extern BOOL HTNetCall_addBefore (HTList * list, HTNetBefore * before,
                    122:                                 const char * tmplate, void * param,
                    123:                                  int order);
                    124: </PRE>
                    125: <P>
                    126: You can also unregister all instances of a BEFORE filter from a list using
                    127: the following function
                    128: <PRE>
                    129: extern BOOL HTNetCall_deleteBefore (HTList * list, HTNetBefore * before);
                    130: </PRE>
                    131: <P>
                    132: You get rid of all BEFORE filters usign this function
                    133: <PRE>
                    134: extern BOOL HTNetCall_deleteBeforeAll (HTList * list);
                    135: </PRE>
                    136: <P>
                    137: The BEFORE filters are expected and called if appropriate every time we issue
                    138: a new request. Libwww calls the BEFORE filters in the order specified at
                    139: registration time. If a filter returns other than HT_OK then stop and return
                    140: immediately. Otherwise return what the last filter returns.
                    141: <PRE>
                    142: extern int HTNetCall_executeBefore (HTList * list, HTRequest * request);
                    143: </PRE>
                    144: <H3>
                    145:   AFTER Filters
                    146: </H3>
                    147: <P>
                    148: An <I>AFTER</I> filter is called whenever we have terminated a request. That
                    149: is, on the way out from the <A HREF="HTProt.html">protocol module</A> and
                    150: back to the application. <I>AFTER</I> filters are registered with a
                    151: <I>context</I>, a <I>status</I>, a <I>filter order</I> by which they are
                    152: to be called and a <I>URL template</I> which may be NULL. The status of the
                    153: request may determine which filter to call. The set of possible values are
                    154: given below. An <I>AFTER</I> filter can be registered to handle one or more
                    155: of the codes.
2.17      frystyk   156: <DL>
2.36      eric      157:   <DT>
                    158:     HT_ERROR
                    159:   <DD>
                    160:     An error occured
                    161:   <DT>
                    162:     HT_LOADED
                    163:   <DD>
                    164:     The document was loaded
                    165:   <DT>
                    166:     HT_NO_DATA
                    167:   <DD>
                    168:     OK, but no data
                    169:   <DT>
2.43      frystyk   170:     HT_NO_ACCESS
                    171:   <DD>
                    172:     The request could not be succeeded due to lack of credentials
                    173:   <DT>
                    174:     HT_NO_PROXY_ACCESS
                    175:   <DD>
                    176:     The request could not be succeeded due to lack of credentials for accessing
                    177:     an intermediate proxy
                    178:   <DT>
2.36      eric      179:     HT_RETRY
                    180:   <DD>
                    181:     Retry request after at a later time
                    182:   <DT>
2.40      frystyk   183:     HT_PERM_REDIRECT
2.36      eric      184:   <DD>
2.40      frystyk   185:     The request has been permanently redirected and we send back the new URL
                    186:   <DT>
                    187:     HT_TEMP_REDIRECT
                    188:   <DD>
                    189:     The request has been temporaryly redirected and we send back the new URL
2.36      eric      190:   <DT>
                    191:     HT_ALL
                    192:   <DD>
                    193:     All of above
2.17      frystyk   194: </DL>
2.36      eric      195: <P>
2.44      frystyk   196: A Protocol module can also in certain cases return a <CODE>HT_IGNORE </CODE>in
                    197: which case no filters are called
                    198: <PRE>
                    199: typedef int HTNetAfter (HTRequest * request, HTResponse * response,
                    200:                         void * param, int status);
                    201: </PRE>
                    202: <P>
                    203: You can register a AFTER filter in the list provided by the caller. Several
                    204: filters can be registered in which case they are called with the filter ordering
                    205: in mind.
2.1       frystyk   206: <PRE>
2.44      frystyk   207: extern BOOL HTNetCall_addAfter (HTList * list, HTNetAfter * after,
                    208:                                const char * tmplate, void * param,
                    209:                                int status, int order);
2.9       frystyk   210: </PRE>
2.36      eric      211: <P>
2.44      frystyk   212: You can either unregister all filters registered for a given status using this function or the filter for all status codes.
2.9       frystyk   213: <PRE>
2.44      frystyk   214: extern BOOL HTNetCall_deleteAfter (HTList * list, HTNetAfter * after);
                    215: extern BOOL HTNetCall_deleteAfterStatus (HTList * list, int status);
2.1       frystyk   216: </PRE>
2.36      eric      217: <P>
2.44      frystyk   218: You can also delete all AFTER filters in list
2.24      frystyk   219: <PRE>
2.44      frystyk   220: extern BOOL HTNetCall_deleteAfterAll (HTList * list);
2.24      frystyk   221: </PRE>
2.36      eric      222: <P>
2.44      frystyk   223: This function calls all the AFTER filters in the order specified at registration
                    224: time and if it has the right status code and it's not <CODE>HT_IGNORE</CODE>.
                    225: We also check for any template and whether it matches or not. If a filter
                    226: returns other than HT_OK then stop and return immediately. Otherwise return
                    227: what the last filter returns.
2.24      frystyk   228: <PRE>
2.44      frystyk   229: extern int HTNetCall_executeAfter (HTList * list, HTRequest * request,
                    230:                                   int status);
2.24      frystyk   231: </PRE>
2.44      frystyk   232: <H2>
                    233:   Global BEFORE and AFTER Filter Management
                    234: </H2>
                    235: <P>
                    236: Global filters are inspected on every request (they do not have to be called
                    237: - only if the conditions match). You can also register filters locally in
                    238: the Request object.
                    239: <H4>
                    240:   Global BEFORE Filters
                    241: </H4>
2.36      eric      242: <P>
2.44      frystyk   243: These are the methods to handle global <I>BEFORE</I> Filters.
2.24      frystyk   244: <PRE>
2.44      frystyk   245: extern BOOL HTNet_setBefore (HTList * list);
                    246: 
                    247: extern HTList * HTNet_before (void);
2.42      frystyk   248: 
2.44      frystyk   249: extern BOOL HTNet_addBefore (HTNetBefore * before, const char * tmplate,
                    250:                             void * param, int order);
2.42      frystyk   251: 
2.44      frystyk   252: extern BOOL HTNet_deleteBefore (HTNetBefore * before);
2.24      frystyk   253: </PRE>
2.36      eric      254: <P>
2.44      frystyk   255: You can call both the local and the global BEFORE filters (if any)
                    256: <PRE>
                    257: extern int HTNet_executeBeforeAll (HTRequest * request);
                    258: </PRE>
                    259: <H4>
                    260:   Global AFTER Filters
                    261: </H4>
                    262: <P>
                    263: These are the methods to handle global <I>AFTER</I> Filters.
2.10      frystyk   264: <PRE>
2.44      frystyk   265: extern BOOL HTNet_setAfter (HTList * list);
                    266: 
                    267: extern HTList * HTNet_after (void);
                    268: 
                    269: extern BOOL HTNet_addAfter (HTNetAfter * after, const char * tmplate,
                    270:                            void * param, int status, int order);
2.42      frystyk   271: 
2.44      frystyk   272: extern BOOL HTNet_deleteAfter (HTNetAfter * after);
2.42      frystyk   273: 
2.44      frystyk   274: extern BOOL HTNet_deleteAfterStatus (int status);
                    275: </PRE>
                    276: <P>
                    277: You can call both the local and the global AFTER filters (if any)
                    278: <PRE>
                    279: extern int HTNet_executeAfterAll (HTRequest * request, int status);
2.10      frystyk   280: </PRE>
2.36      eric      281: <H2>
2.43      frystyk   282:   Socket Resource Management
2.36      eric      283: </H2>
                    284: <P>
                    285: The request queue ensures that no more than a fixed number of TCP connections
                    286: are open at the same time. If more requests are handed to the Library, they
                    287: are put into the pending queue and initiated when sockets become free.
                    288: <H3>
                    289:   Number of Simultanous open TCP connections
                    290: </H3>
                    291: <P>
                    292: Set the max number of simultanous sockets. The default value is HT_MAX_SOCKETS
                    293: which is 6. The number of persistent connections depend on this value as
                    294: a deadlock can occur if all available sockets a persistent (see the
                    295: <A HREF="HTDNS.html">DNS Manager</A> for more information on setting the
                    296: number of persistent connections). The number of persistent connections can
                    297: never be more than the max number of sockets-2, so letting newmax=2 prevents
                    298: persistent sockets.
2.1       frystyk   299: <PRE>
2.17      frystyk   300: extern BOOL HTNet_setMaxSocket (int newmax);
                    301: extern int  HTNet_maxSocket (void);
2.1       frystyk   302: </PRE>
2.36      eric      303: <H3>
2.43      frystyk   304:   Socket Counters
                    305: </H3>
                    306: <PRE>
                    307: extern void HTNet_increaseSocket (void);
                    308: extern void HTNet_decreaseSocket (void);
                    309: 
                    310: extern int HTNet_availableSockets (void);
                    311: </PRE>
                    312: <H3>
                    313:   Persistent Socket Counters
                    314: </H3>
                    315: <PRE>
                    316: extern void HTNet_increasePersistentSocket (void);
                    317: extern void HTNet_decreasePersistentSocket (void);
                    318: 
                    319: extern int HTNet_availablePersistentSockets (void);
                    320: </PRE>
                    321: <H3>
                    322:   Any Ongoing Connections?
                    323: </H3>
                    324: <P>
                    325: Returns whether there are active requests. Idle persistent sockets do not
                    326: count as active.
                    327: <PRE>
                    328: extern BOOL HTNet_isIdle (void);
                    329: </PRE>
                    330: <H3>
2.36      eric      331:   List Active Queue
                    332: </H3>
                    333: <P>
                    334: Returns the list of active requests that are currently having an open connection.
                    335: Returns list of HTNet objects or NULL if error.
2.1       frystyk   336: <PRE>
2.17      frystyk   337: extern HTList *HTNet_activeQueue (void);
2.22      frystyk   338: extern BOOL HTNet_idle (void);
2.29      frystyk   339: </PRE>
2.36      eric      340: <H3>
                    341:   Are we Active?
                    342: </H3>
                    343: <P>
                    344: We have some small functions that tell whether there are registered requests
                    345: in the Net manager. There are tree queues: The <EM>active</EM>, the
                    346: <EM>pending</EM>, and the <EM>persistent</EM>. The <EM>active</EM> queue
                    347: is the set of requests that are actively sending or receiving data. The
                    348: <EM>pending</EM> is the requests that we have registered but which are waiting
                    349: for a free socket. The <EM>Persistent</EM> queue are requets that are waiting
                    350: to use the same socket in order to save network resoures (if the server
                    351: understands persistent connections).
                    352: <H4>
2.44.2.3  frystyk   353:   Active Requests?
2.36      eric      354: </H4>
                    355: <P>
2.29      frystyk   356: Returns whether there are requests in the <EM>active</EM> queue or not
                    357: <PRE>
                    358: extern BOOL HTNet_idle (void);
                    359: </PRE>
2.36      eric      360: <H4>
                    361:   Registered Requests?
                    362: </H4>
                    363: <P>
                    364: Returns whether there are requests registered in any of the lists or not
2.29      frystyk   365: <PRE>
                    366: extern BOOL HTNet_isEmpty (void);
2.44.2.5! eric      367: extern int HTNet_count (void);
2.1       frystyk   368: </PRE>
2.36      eric      369: <H3>
                    370:   List Pending Queue
                    371: </H3>
                    372: <P>
                    373: Returns the list of pending requests that are waiting to become active. Returns
                    374: list of HTNet objects or NULL if error
2.1       frystyk   375: <PRE>
2.17      frystyk   376: extern HTList *HTNet_pendingQueue (void);
2.1       frystyk   377: </PRE>
2.36      eric      378: <H2>
2.37      frystyk   379:   Creation and Deletion Methods
2.36      eric      380: </H2>
                    381: <P>
2.37      frystyk   382: The Net object is intended to live as long as the request is still active.
                    383: In that regard it is very similar to the <A HREF="HTReq.html">Request Object
                    384: </A>. However, the main difference is that a Net object represents a "thread"
                    385: in the Library and a request may have multiple "threads" - an example is
                    386: a FTP request which has a thread to handle the control connection and one
                    387: to handle the data connections.
                    388: <H3>
                    389:   Create a new Object
                    390: </H3>
                    391: <P>
                    392: If we have more than HTMaxActive connections already then put this into the
                    393: pending queue, else start the request by calling the call back function
                    394: registered with this access method. Returns YES if OK, else NO
2.27      frystyk   395: <PRE>
2.28      frystyk   396: extern BOOL HTNet_newClient (HTRequest * request);
2.27      frystyk   397: </PRE>
2.36      eric      398: <P>
                    399: You can create a new HTNet object as a new request to be handled. If we have
                    400: more than HTMaxActive connections already then return NO. Returns YES if
                    401: OK, else NO
2.17      frystyk   402: <PRE>
2.39      frystyk   403: extern BOOL HTNet_newServer (HTRequest * request, HTNet * net, char *access);
2.26      frystyk   404: </PRE>
2.36      eric      405: <P>
2.27      frystyk   406: And you can create a plain new HTNet object using the following method:
2.26      frystyk   407: <PRE>
2.44.2.2  frystyk   408: extern HTNet * HTNet_new (HTRequest * request);
2.20      frystyk   409: </PRE>
2.36      eric      410: <H3>
2.37      frystyk   411:   Duplicate an existing Object
2.36      eric      412: </H3>
                    413: <P>
                    414: Creates a new HTNet object as a duplicate of the same request. Returns YES
                    415: if OK, else NO.
2.20      frystyk   416: <PRE>
2.30      frystyk   417: extern HTNet * HTNet_dup (HTNet * src);
2.17      frystyk   418: </PRE>
2.37      frystyk   419: <H3>
2.43      frystyk   420:   Launch a Net Object
                    421: </H3>
                    422: <P>
                    423: Start a Net obejct by calling the protocol module.
                    424: <PRE>extern BOOL HTNet_start (HTNet * net);
                    425: </PRE>
2.44.2.4  frystyk   426: 
                    427: <H3>
                    428: Call a Net Event Handler 
                    429: </H3>
                    430: 
                    431: This functions lets the caller play event manager as it can calls any
                    432: event handler with the event type and context passed to the function
                    433: 
                    434: <PRE>
                    435: extern BOOL HTNet_execute (HTNet * net, HTEventType type);
                    436: </PRE>
                    437: 
2.43      frystyk   438: <H3>
2.37      frystyk   439:   Delete an Object
                    440: </H3>
                    441: <P>
                    442: Deletes the HTNet object from the list of active requests and calls any
                    443: registered call back functions IF not the status is HT_IGNORE. This is used
                    444: if we have internal requests that the app doesn't know about. We also see
                    445: if we have pending requests that can be started up now when we have a socket
2.43      frystyk   446: free. The filters are called in the reverse order of which they were registered
                    447: (last one first);
2.37      frystyk   448: <PRE>
                    449: extern BOOL HTNet_delete (HTNet * me, int status);
                    450: </PRE>
                    451: <H3>
                    452:   Delete ALL HTNet Objects
                    453: </H3>
                    454: <P>
                    455: Deletes all HTNet object that might either be active or pending We DO NOT
                    456: call the call back functions - A crude way of saying goodbye!
                    457: <PRE>
                    458: extern BOOL HTNet_deleteAll (void);
                    459: </PRE>
2.36      eric      460: <H2>
2.38      frystyk   461:   Net Class Methods
2.36      eric      462: </H2>
                    463: <H3>
                    464:   Make an Object Wait
                    465: </H3>
                    466: <P>
                    467: Let a net object wait for a persistent socket. It will be launched from the
                    468: HTNet_delete() function when the socket gets free.
2.19      frystyk   469: <PRE>
                    470: extern BOOL HTNet_wait (HTNet *net);
                    471: </PRE>
2.36      eric      472: <H3>
                    473:   Priority Management
                    474: </H3>
                    475: <P>
                    476: Each HTNet object is created with a priority which it inherits from the
                    477: <A HREF="HTReq.html">Request manager</A>. However, in some stuations it is
                    478: useful to be to change the current priority after the request has been started.
                    479: These two functions allow you to do this. The effect will show up the first
                    480: time (which might be imidiately) the socket blocks and control returns to
                    481: the event loop. Also have a look at how you can do this before the request
                    482: is issued in the <A HREF="HTReq.html">request manager</A>.
2.23      frystyk   483: <PRE>
                    484: extern HTPriority HTNet_priority (HTNet * net);
                    485: extern BOOL HTNet_setPriority (HTNet * net, HTPriority priority);
                    486: </PRE>
2.36      eric      487: <H3>
                    488:   Persistent Connections
                    489: </H3>
                    490: <P>
                    491: You can set a Net object to handle persistent connections for example using
                    492: HTTP, NNTP, or FTP. You can control whether a Net object supports persistent
                    493: connections or not using this function.
2.33      frystyk   494: <PRE>
                    495: extern BOOL HTNet_persistent (HTNet * net);
                    496: </PRE>
2.36      eric      497: <P>
                    498: You can set or disable a Net object supporting persistent connections using
                    499: this function:
2.33      frystyk   500: <PRE>
2.43      frystyk   501: extern BOOL HTNet_setPersistent (HTNet *           net,
                    502:                                  BOOL              persistent,
                    503:                                  HTTransportMode   mode);
2.33      frystyk   504: </PRE>
2.36      eric      505: <H3>
                    506:   Kill a Request
                    507: </H3>
                    508: <P>
                    509: Kill the request by calling the call back function with a request for closing
                    510: the connection. Does not remove the object. This is done by HTNet_delete()
                    511: function which is called by the load routine. Returns OK if success, NO on
                    512: error
2.1       frystyk   513: <PRE>
2.17      frystyk   514: extern BOOL HTNet_kill (HTNet * me);
2.1       frystyk   515: </PRE>
2.36      eric      516: <H3>
                    517:   Kill ALL requests
                    518: </H3>
                    519: <P>
                    520: Kills all registered (active+pending) requests by calling the call back function
                    521: with a request for closing the connection. We do not remove the HTNet object
                    522: as it is done by HTNet_delete(). Returns OK if success, NO on error
2.1       frystyk   523: <PRE>
2.17      frystyk   524: extern BOOL HTNet_killAll (void);
2.28      frystyk   525: </PRE>
2.36      eric      526: <H3>
                    527:   Create Input and Output Streams
                    528: </H3>
                    529: <P>
                    530: You create the input stream and bind it to the channel using the following
                    531: methods. Please read the description in the
                    532: <A HREF="HTIOStream.html">HTIOStream module</A> on the parameters
                    533: <EM>target</EM>, <EM>param</EM>, and <EM>mode</EM>. Both methods return YES
                    534: if OK, else NO.
2.34      frystyk   535: <PRE>
2.44.2.1  eric      536: #if 0
2.34      frystyk   537: extern HTInputStream * HTNet_getInput (HTNet * net, HTStream * target,
                    538:                                       void * param, int mode);
2.44.2.1  eric      539: #endif
                    540: extern HTOutputStream * HTNet_getOutput (HTNet * me, void * param, int mode);
2.34      frystyk   541: </PRE>
2.37      frystyk   542: <H3>
                    543:   Net Context Descriptor
                    544: </H3>
2.36      eric      545: <P>
2.37      frystyk   546: Just like the <A HREF="../../../../WWW/Library/src/HTReq.html#context">request
                    547: object</A>, a net object can be assigned a context which keeps track of context
                    548: dependent information. The Library does not use this information nor does
                    549: it depend on it but it allows the application to customize a net object to
                    550: specific uses.
                    551: <PRE>extern BOOL HTNet_setContext (HTNet * net, void * context);
                    552: extern void * HTNet_context (HTNet * net);
                    553: </PRE>
2.36      eric      554: <H3>
                    555:   Socket Descriptor
                    556: </H3>
2.28      frystyk   557: <PRE>
                    558: extern BOOL HTNet_setSocket (HTNet * net, SOCKET sockfd);
                    559: extern SOCKET HTNet_socket (HTNet * net);
2.17      frystyk   560: </PRE>
2.36      eric      561: <H3>
2.39      frystyk   562:   The Request Object
                    563: </H3>
                    564: <P>
2.43      frystyk   565: The <A HREF="HTReq.html">Request object</A> is normally set up automatically
                    566: but can be changed at a later time.
2.39      frystyk   567: <PRE>
                    568: extern BOOL HTNet_setRequest (HTNet * net, HTRequest * request);
                    569: extern HTRequest * HTNet_request (HTNet * net);
                    570: </PRE>
2.44.2.3  frystyk   571: 
                    572: <H3>
                    573: The Protocol Object
                    574: </H3>
                    575: 
                    576: <PRE>
                    577: extern BOOL HTNet_setProtocol (HTNet * net, HTProtocol * protocol);
                    578: extern HTProtocol * HTNet_protocol (HTNet * net);
                    579: </PRE>
                    580: 
2.39      frystyk   581: <H3>
2.36      eric      582:   The Transport Object
                    583: </H3>
                    584: <P>
2.34      frystyk   585: The <A HREF="HTTransport.html">transport object</A> is normally set up
                    586: automatically but can be changed at a later time.
2.17      frystyk   587: <PRE>
2.34      frystyk   588: extern BOOL HTNet_setTransport (HTNet * net, HTTransport * tp);
                    589: extern HTTransport * HTNet_transport (HTNet * net);
                    590: </PRE>
2.36      eric      591: <H3>
                    592:   The Channel Object
                    593: </H3>
2.34      frystyk   594: <PRE>
                    595: extern BOOL HTNet_setChannel (HTNet * net, HTChannel * channel);
                    596: extern HTChannel * HTNet_channel (HTNet * net);
                    597: </PRE>
2.36      eric      598: <H3>
                    599:   The Host Object
                    600: </H3>
2.34      frystyk   601: <PRE>
                    602: extern BOOL HTNet_setHost (HTNet * net, HTHost * host);
                    603: extern HTHost * HTNet_host (HTNet * net);
                    604: </PRE>
2.36      eric      605: <H3>
                    606:   The DNS Object
                    607: </H3>
2.43      frystyk   608: <P>
                    609: The DNS object keeps track of the DNS entries that we have already checked
                    610: out.
2.34      frystyk   611: <PRE>
                    612: extern BOOL HTNet_setDns (HTNet * net, HTdns * dns);
                    613: extern HTdns * HTNet_dns (HTNet * net);
                    614: </PRE>
2.43      frystyk   615: <P>
                    616: If we are talking to a multi-homed host then we may connect to any of the
                    617: homes. In that case we store the current home in the Net object so that we
                    618: can query about it later.
2.41      frystyk   619: <PRE>
                    620: extern int HTNet_home (HTNet * net);
                    621: </PRE>
2.44.2.2  frystyk   622: 
                    623: <H3>
                    624: Target for Input Read Stream
                    625: </H3>
                    626: 
                    627: <PRE>
                    628: extern HTStream * HTNet_readStream(HTNet * net);
                    629: extern BOOL HTNet_setReadStream (HTNet * net, HTStream * stream);
                    630: </PRE>
                    631: 
2.34      frystyk   632: <PRE>
2.17      frystyk   633: #endif /* HTNET_H */
2.1       frystyk   634: </PRE>
2.36      eric      635: <P>
                    636:   <HR>
2.34      frystyk   637: <ADDRESS>
2.44.2.5! eric      638:   @(#) $Id: HTNet.html,v 2.44.2.4 1996/11/06 00:38:43 frystyk Exp $
2.34      frystyk   639: </ADDRESS>
2.36      eric      640: </BODY></HTML>

Webmaster