Annotation of libwww/Library/src/HTAnchor.html, revision 2.58

2.7       timbl       1: <HTML>
                      2: <HEAD>
2.47      frystyk     3:   <!-- Changed by: Henrik Frystyk Nielsen, 16-Jul-1996 -->
2.51      frystyk     4:   <TITLE>W3C Sample Code Library libwww Anchor Class</TITLE>
2.8       timbl       5: </HEAD>
2.6       timbl       6: <BODY>
2.42      frystyk     7: <H1>
2.44      frystyk     8:   The Anchor Class
2.42      frystyk     9: </H1>
2.15      frystyk    10: <PRE>
                     11: /*
2.23      frystyk    12: **     (c) COPYRIGHT MIT 1995.
2.15      frystyk    13: **     Please first read the full copyright statement in the file COPYRIGH.
                     14: */
                     15: </PRE>
2.42      frystyk    16: <P>
                     17: An anchor represents a region of a hypertext document which is linked to
                     18: another anchor in the same or a different document. Another name for anchors
                     19: would be URLs as an anchor represents all we know about a URL - including
                     20: where it points to and who points to it.&nbsp;Because the anchor objects
                     21: represent the part of the Web, the application has been in touch, it is often
                     22: useful to maintain the anchors throughout the lifetime of the application.
                     23: It would actually be most useful if we had persistent anchors so that an
2.44      frystyk    24: application could build up a higher knowledge about the Web topology.
2.42      frystyk    25: <P>
                     26: This module is implemented by <A HREF="HTAnchor.c">HTAnchor.c</A>, and it
2.57      frystyk    27: is a part of the <A HREF="http://www.w3.org/Library/"> W3C Sample Code
2.42      frystyk    28: Library</A>.
2.15      frystyk    29: <PRE>
                     30: #ifndef HTANCHOR_H
1.1       timbl      31: #define HTANCHOR_H
2.24      frystyk    32: 
2.18      frystyk    33: </PRE>
2.42      frystyk    34: <H2>
                     35:   Types defined and used by the Anchor Object
                     36: </H2>
                     37: <P>
                     38: This is a set of videly used type definitions used through out the Library:
2.24      frystyk    39: <PRE>
2.44      frystyk    40: #include "WWWUtil.h"
2.35      frystyk    41: 
2.24      frystyk    42: typedef HTAtom * HTFormat;
                     43: typedef HTAtom * HTLevel;                     /* Used to specify HTML level */
2.40      frystyk    44: typedef HTAtom * HTEncoding;                               /* C-E and C-T-E */
2.24      frystyk    45: typedef HTAtom * HTCharset;
                     46: typedef HTAtom * HTLanguage;
2.35      frystyk    47: 
                     48: typedef struct _HTAnchor       HTAnchor;
                     49: typedef struct _HTParentAnchor HTParentAnchor;
                     50: typedef struct _HTChildAnchor  HTChildAnchor;
2.28      frystyk    51: 
2.44      frystyk    52: #include "HTLink.h"
                     53: #include "HTMethod.h"
2.49      frystyk    54: #include "HTResponse.h"
2.35      frystyk    55: </PRE>
2.42      frystyk    56: <H2>
                     57:   The Anchor Class
                     58: </H2>
                     59: <P>
                     60: We have three variants of the Anchor object - I guess some would call them
                     61: superclass and subclasses ;-) <A NAME="Generic"></A>
                     62: <H3>
2.44      frystyk    63:   <A NAME="Generic">Anchor Base Class</A>
2.42      frystyk    64: </H3>
                     65: <P>
                     66: This is the super class of anchors. We often use this as an argument to the
                     67: functions that both accept parent anchors and child anchors. We separate
                     68: the first link from the others to avoid too many small mallocs involved by
                     69: a list creation. Most anchors only point to one place. <A NAME="parent"></A>
                     70: <H3>
                     71:   <A NAME="parent">Anchor for a Parent Object</A>
                     72: </H3>
                     73: <P>
2.44      frystyk    74: These anchors points to the whole contents of any resource accesible by a
                     75: URI. The parent anchor now contains all known metainformation about that
                     76: object and in some cases the parent anchor also contains the document itself.
                     77: Often we get the metainformation about a document via the entity headers
                     78: in the HTTP specification.
2.42      frystyk    79: <H3>
                     80:   <A NAME="child">Anchor for a Child Object</A>
                     81: </H3>
                     82: <P>
2.44      frystyk    83: A child anchor is a anchor object that points to a subpart of a hypertext
                     84: document. In HTML this is represented by the <CODE>NAME</CODE> tag of the
                     85: Anchor element.
2.42      frystyk    86: <P>
                     87: After we have defined the data structures we must define the methods that
                     88: can be used on them. All anchors are kept in an internal hash table so that
                     89: they are easier to find again.
                     90: <H3>
                     91:   Find/Create a Parent Anchor
                     92: </H3>
                     93: <P>
                     94: This one is for a reference (link) which is found in a document, and might
                     95: not be already loaded. The parent anchor returned can either be created on
                     96: the spot or is already in the hash table.
2.18      frystyk    97: <PRE>
2.37      frystyk    98: extern HTAnchor * HTAnchor_findAddress         (const char * address);
2.18      frystyk    99: </PRE>
2.42      frystyk   100: <H3>
                    101:   Find/Create a Child Anchor
                    102: </H3>
                    103: <P>
                    104: This one is for a new child anchor being edited into an existing document.
                    105: The parent anchor must already exist but the child returned can either be
                    106: created on the spot or is already in the hash table. The <EM>tag</EM> is
                    107: the part that's after the '#' sign in a URI.
2.18      frystyk   108: <PRE>
2.32      frystyk   109: extern HTChildAnchor * HTAnchor_findChild      (HTParentAnchor *parent,
2.37      frystyk   110:                                                 const char *   tag);
2.7       timbl     111: </PRE>
2.42      frystyk   112: <H3>
                    113:   Find/Create a Child Anchor and Link to Another Parent
                    114: </H3>
                    115: <P>
                    116: Find a child anchor anchor with a given parent and possibly a <EM>tag</EM>,
                    117: and (if passed) link this child to the URI given in the <EM>href</EM>. As
                    118: we really want typed links to the caller should also indicate what the type
                    119: of the link is (see HTTP spec for more information). The link is
                    120: <EM>relative</EM> to the address of the parent anchor.
2.18      frystyk   121: <PRE>
2.43      eric      122: extern HTChildAnchor * HTAnchor_findChildAndLink (
                    123:                HTParentAnchor * parent,                /* May not be 0 */
2.37      frystyk   124:                const char * tag,                       /* May be "" or 0 */
                    125:                const char * href,                      /* May be "" or 0 */
2.35      frystyk   126:                HTLinkType ltype);                      /* May be 0 */
2.18      frystyk   127: </PRE>
2.42      frystyk   128: <H3>
                    129:   Delete an Anchor
                    130: </H3>
                    131: <P>
                    132: All outgoing links from parent and children are deleted, and this anchor
                    133: is removed from the sources list of all its targets. We also delete the targets.
                    134: If this anchor's source list is empty, we delete it and its children.
2.18      frystyk   135: <PRE>
2.32      frystyk   136: extern BOOL HTAnchor_delete    (HTParentAnchor *me);
2.20      frystyk   137: </PRE>
2.42      frystyk   138: <H3>
                    139:   Delete all Anchors
                    140: </H3>
                    141: <P>
                    142: Deletes <EM>all</EM> anchors and return a list of all the objects (hyperdoc)
                    143: hanging of the parent anchors found while doing it. The application may keep
                    144: its own list of <CODE>HyperDoc</CODE>s, but this function returns it anyway.
                    145: It is <EM>always</EM> for the application to delete any
                    146: <CODE>HyperDoc</CODE>s. If NULL then no hyperdocs are returned. Return YES
                    147: if OK, else NO.
                    148: <P>
                    149: <B>Note:</B> This function is different from cleaning up the history list!
2.20      frystyk   150: <PRE>
2.32      frystyk   151: extern BOOL HTAnchor_deleteAll (HTList * objects);
2.18      frystyk   152: </PRE>
2.52      frystyk   153: 
                    154: <H3>
                    155:   Flatten all anchors into Array
                    156: </H3>
                    157: 
                    158: Flattens the anchor web structure into an array.  This is useful for
                    159: calculating statistics, sorting the parent anchors etc.<P>
                    160: 
                    161: The caller can indicate the size of the array (total number of anchors
                    162: if known - otherwise 0).<P>
                    163: 
                    164: Return an array that must be freed by the caller or NULL if no
                    165: anchors.<P>
                    166: 
                    167: <PRE>
                    168: extern HTArray * HTAnchor_getArray (int growby);
                    169: </PRE>
                    170: 
2.42      frystyk   171: <H2>
2.44      frystyk   172:   <A NAME="links">Links and Anchors</A>
2.42      frystyk   173: </H2>
                    174: <P>
2.44      frystyk   175: Anchor objects are bound together by <A HREF="HTLink.html">Link objects</A>
                    176: that carry information about what type of link and whetther we have followed
                    177: the link etc. Any anchor object can have zero, one, or many links but the
                    178: normal case is one. Therefore we treat this is a special way.
                    179: <H3>
                    180:   Handling the Main Link
                    181: </H3>
                    182: <P>
                    183: Any outgoing link can at any time be the main destination.
                    184: <PRE>
                    185: extern BOOL HTAnchor_setMainLink       (HTAnchor * anchor, HTLink * link);
                    186: extern HTLink * HTAnchor_mainLink      (HTAnchor * anchor);
                    187: 
                    188: extern HTAnchor * HTAnchor_followMainLink (HTAnchor * anchor);
                    189: </PRE>
2.42      frystyk   190: <H3>
2.44      frystyk   191:   Handling the Sub Links
2.42      frystyk   192: </H3>
2.44      frystyk   193: <PRE>
                    194: extern BOOL HTAnchor_setSubLinks       (HTAnchor * anchor, HTList * list);
                    195: extern HTList * HTAnchor_subLinks      (HTAnchor * anchor);
                    196: </PRE>
2.53      frystyk   197: 
                    198: <H3>
                    199:   Search for a Link Type
                    200: </H3>
                    201: 
                    202: Links can have relations (indicated by the "rel" or "rev" HTML link
                    203: attributes).  This function can search an anchor looking for a
                    204: specific type, for example "stylesheet".
                    205: 
                    206: <PRE>
                    207: extern HTLink * HTAnchor_findLinkType (HTAnchor * me, HTLinkType type);
                    208: </PRE>
                    209: 
2.44      frystyk   210: <H2>
                    211:   Relations Between Children and Parents
                    212: </H2>
                    213: <P>
                    214: As always, children and parents have a compliated relationship and the libwww
                    215: Anchor class is no exception.
                    216: <H3>
2.42      frystyk   217:   Who is Parent?
2.44      frystyk   218: </H3>
2.42      frystyk   219: <P>
2.18      frystyk   220: For parent anchors this returns the anchor itself
2.44      frystyk   221: <PRE>extern HTParentAnchor * HTAnchor_parent   (HTAnchor *me);
2.18      frystyk   222: </PRE>
2.44      frystyk   223: <H3>
2.42      frystyk   224:   Does it have any Anchors within it?
2.44      frystyk   225: </H3>
                    226: <P>
                    227: Does this parent anchor have any children
                    228: <PRE>extern BOOL HTAnchor_hasChildren  (HTParentAnchor *me);
                    229: </PRE>
2.56      frystyk   230: <H3>
                    231:   Is this anchor a Child?
                    232: </H3>
                    233: <PRE>
                    234: extern BOOL HTAnchor_isChild (HTAnchor * me);
                    235: </PRE>
                    236: 
                    237: <H3>
                    238:   Get the Tag/Fragment/View of this anchor
                    239: </H3>
                    240: 
                    241: If this is a child anchor then it has a tag (often also called a "fragment"), which
                    242: is essentially a specific <B>view</B> of a document. This is why I like to call it
                    243: a view instead of a fragment. The string returned (if non-NULL) must be freed by the
                    244: caller.
                    245: 
                    246: <PRE>
                    247: extern char * HTAnchor_view (HTAnchor * me);
                    248: </PRE>
                    249: 
2.44      frystyk   250: <H2>
2.45      frystyk   251:   Anchor Addresses
2.44      frystyk   252: </H2>
                    253: <P>
                    254: There are two addresses of an anchor. The URI that was passed when the anchor
                    255: was crated and the physical address that's used when the URI is going to
                    256: be requested. The two addresses may be different if the request is going
2.45      frystyk   257: through a proxy or a gateway or it may have been mapped through a rule file.
2.44      frystyk   258: <H3>
                    259:   Logical Address
                    260: </H3>
                    261: <P>
                    262: Returns the full URI of the anchor, child or parent as a malloc'd string
                    263: to be freed by the caller as when the anchor was created.
                    264: <PRE>extern char * HTAnchor_address            (HTAnchor * me);
2.18      frystyk   265: </PRE>
2.42      frystyk   266: <H3>
2.45      frystyk   267:   Expanded Logical Address
                    268: </H3>
                    269: <P>
                    270: When expanding URLs within a hypertext document, the base address is taken
                    271: as the following value if present (in that order):
                    272: <UL>
                    273:   <LI>
                    274:     <CODE>Content-Base</CODE> header
                    275:   <LI>
                    276:     <CODE>Content-Location</CODE> header
                    277:   <LI>
                    278:     Logical address
                    279: </UL>
                    280: <PRE>extern char * HTAnchor_expandedAddress  (HTAnchor * me);
                    281: </PRE>
                    282: <H3>
2.44      frystyk   283:   Physical address
2.42      frystyk   284: </H3>
                    285: <P>
2.44      frystyk   286: Contains the physical address after we haved looked for proxies etc.
                    287: <PRE>extern char * HTAnchor_physical           (HTParentAnchor * me);
                    288: extern void HTAnchor_setPhysical       (HTParentAnchor * me, char * protocol);
2.45      frystyk   289: extern void HTAnchor_clearPhysical     (HTParentAnchor * me);
2.44      frystyk   290: </PRE>
                    291: <H2>
                    292:   Entity Body Information
                    293: </H2>
                    294: <P>
2.42      frystyk   295: A parent anchor can have a data object bound to it. This data object does
                    296: can for example be a parsed version of a HTML that knows how to present itself
                    297: to the user, or it can be an unparsed data object. It's completely free for
                    298: the application to use this possibility, but a typical usage would to manage
                    299: the data object as part of a memory cache.
2.18      frystyk   300: <PRE>
2.35      frystyk   301: extern void HTAnchor_setDocument       (HTParentAnchor *me, void * doc);
                    302: extern void * HTAnchor_document                (HTParentAnchor *me);
2.18      frystyk   303: </PRE>
2.44      frystyk   304: <H2>
                    305:   Entity Header Information
                    306: </H2>
                    307: <P>
                    308: The anchor object also contains all the metainformation that we know about
                    309: the object.
2.42      frystyk   310: <H3>
2.44      frystyk   311:   Clear All header Information
2.42      frystyk   312: </H3>
2.49      frystyk   313: <PRE>
                    314: extern void HTAnchor_clearHeader       (HTParentAnchor *me);
2.42      frystyk   315: </PRE>
                    316: <H3>
2.49      frystyk   317:   Inherit Metainformation from the Response object
2.47      frystyk   318: </H3>
                    319: <P>
2.49      frystyk   320: Once we have decided to cache the object we transfer already parsed
                    321: metainformation from the <A HREF="HTResponse.html">HTResponse object </A>to
                    322: the anchor object and also the unparsed headers as we may wanna use that
                    323: information later.
2.47      frystyk   324: <PRE>
2.49      frystyk   325: extern BOOL HTAnchor_update (HTParentAnchor * me, HTResponse * response);
2.47      frystyk   326: </PRE>
                    327: <H3>
2.42      frystyk   328:   Is the Anchor searchable?
                    329: </H3>
2.44      frystyk   330: <PRE>extern void HTAnchor_clearIndex           (HTParentAnchor * me);
2.42      frystyk   331: extern void HTAnchor_setIndex          (HTParentAnchor * me);
                    332: extern BOOL HTAnchor_isIndex           (HTParentAnchor * me);
                    333: </PRE>
                    334: <H3>
2.44      frystyk   335:   Anchor Title
2.42      frystyk   336: </H3>
                    337: <P>
                    338: We keep the title in the anchor as we then can refer to it later in the history
                    339: list etc. We can also obtain the title element if it is passed as a HTTP
                    340: header in the response. Any title element found in an HTML document will
                    341: overwrite a title given in a HTTP header.
2.44      frystyk   342: <PRE>extern const char * HTAnchor_title        (HTParentAnchor *me);
2.32      frystyk   343: extern void HTAnchor_setTitle          (HTParentAnchor *me,
2.37      frystyk   344:                                         const char *   title);
2.32      frystyk   345: extern void HTAnchor_appendTitle       (HTParentAnchor *me,
2.37      frystyk   346:                                         const char *   title);
2.18      frystyk   347: </PRE>
2.42      frystyk   348: <H3>
2.54      frystyk   349:   Meta Tags within the Document
                    350: </H3>
                    351: 
                    352: <PRE>
                    353: extern HTAssocList * HTAnchor_meta (HTParentAnchor * me);
                    354: extern BOOL HTAnchor_addMeta (HTParentAnchor * me,
                    355:                              const char * name, const char * value);
                    356: </PRE>
                    357: 
                    358: <H4>
                    359:   The Robots Meta tag
                    360: </H4>
                    361: 
                    362: A special case function that looks for any robots meta tag. This tag
                    363: contains information about which links a robot can traverse and which
                    364: it shouldn't.
                    365: 
                    366: <PRE>
                    367: extern char * HTAnchor_robots (HTParentAnchor * me);
                    368: </PRE>
                    369: 
                    370: <H3>
2.44      frystyk   371:   Content Base
                    372: </H3>
                    373: <P>
2.49      frystyk   374: The <CODE>Content-Base</CODE> header may be used for resolving
                    375: relative URLs within the entity. If it there is no
                    376: <CODE>Content-Base</CODE> header then we use the Content-Location if
                    377: present and absolute.
                    378: <PRE>
                    379: extern char * HTAnchor_base    (HTParentAnchor * me);
2.44      frystyk   380: extern BOOL HTAnchor_setBase   (HTParentAnchor * me, char * base);
                    381: </PRE>
                    382: <H3>
                    383:   Content Location
                    384: </H3>
                    385: <P>
2.49      frystyk   386: Content location can either be an absolute or a relative URL. The URL may
                    387: be either absolute or relative. If it is relative then we parse it relative
                    388: to the <CODE>Content-Base</CODE> header of the request URI if any, otherwise
                    389: we use the Request URI.
                    390: <PRE>
                    391: extern char * HTAnchor_location                (HTParentAnchor * me);
2.44      frystyk   392: extern BOOL HTAnchor_setLocation       (HTParentAnchor * me, char * location);
                    393: </PRE>
                    394: <H3>
2.42      frystyk   395:   Media Types (Content-Type)
                    396: </H3>
2.18      frystyk   397: <PRE>
2.32      frystyk   398: extern HTFormat HTAnchor_format                (HTParentAnchor *me);
                    399: extern void HTAnchor_setFormat         (HTParentAnchor *me,
                    400:                                         HTFormat       form);
2.18      frystyk   401: </PRE>
2.42      frystyk   402: <H3>
2.44      frystyk   403:   Content Type Parameters
                    404: </H3>
                    405: <P>
                    406: The Anchor obejct stores all content parameters in an Association list so
                    407: here you will always be able to find them. We also have a few methods for
                    408: the special cases: <CODE>charset</CODE> and <CODE>level</CODE> as they are
                    409: often needed.
                    410: <PRE>
                    411: extern HTAssocList * HTAnchor_formatParam (HTParentAnchor * me);
                    412: 
                    413: extern BOOL HTAnchor_addFormatParam    (HTParentAnchor * me,
                    414:                                        const char * name, const char * value);
                    415: </PRE>
                    416: <H4>
2.42      frystyk   417:   Charset parameter to Content-Type
2.44      frystyk   418: </H4>
2.18      frystyk   419: <PRE>
2.32      frystyk   420: extern HTCharset HTAnchor_charset      (HTParentAnchor *me);
2.44      frystyk   421: extern BOOL HTAnchor_setCharset                (HTParentAnchor *me,
2.32      frystyk   422:                                         HTCharset      charset);
2.18      frystyk   423: </PRE>
2.44      frystyk   424: <H4>
2.42      frystyk   425:   Level parameter to Content-Type
2.44      frystyk   426: </H4>
2.21      frystyk   427: <PRE>
2.32      frystyk   428: extern HTLevel HTAnchor_level          (HTParentAnchor * me);
2.44      frystyk   429: extern BOOL HTAnchor_setLevel          (HTParentAnchor * me,
2.32      frystyk   430:                                         HTLevel        level);
2.22      frystyk   431: </PRE>
2.42      frystyk   432: <H3>
                    433:   Content Language
                    434: </H3>
2.22      frystyk   435: <PRE>
2.39      frystyk   436: extern HTList * HTAnchor_language      (HTParentAnchor * me);
                    437: extern BOOL HTAnchor_addLanguage       (HTParentAnchor *me, HTLanguage lang);
2.58    ! frystyk   438: extern BOOL HTAnchor_deleteLanguageAll  (HTParentAnchor * me);
2.21      frystyk   439: </PRE>
2.42      frystyk   440: <H3>
                    441:   Content Encoding
                    442: </H3>
2.18      frystyk   443: <PRE>
2.39      frystyk   444: extern HTList * HTAnchor_encoding      (HTParentAnchor * me);
                    445: extern BOOL HTAnchor_addEncoding       (HTParentAnchor * me, HTEncoding enc);
2.58    ! frystyk   446: extern BOOL HTAnchor_deleteEncoding     (HTParentAnchor * me, HTEncoding enc);
        !           447: extern BOOL HTAnchor_deleteEncodingAll  (HTParentAnchor * me);
        !           448: 
        !           449: #define HTAnchor_removeEncoding(a, e)   HTAnchor_deleteEncoding((a), (e))
2.18      frystyk   450: </PRE>
2.42      frystyk   451: <H3>
                    452:   Content Transfer Encoding
                    453: </H3>
2.18      frystyk   454: <PRE>
2.55      frystyk   455: extern HTEncoding HTAnchor_contentTransferEncoding     (HTParentAnchor *me);
                    456: extern void HTAnchor_setContentTransferEncoding                (HTParentAnchor *me,
                    457:                                                         HTEncoding     cte);
2.18      frystyk   458: </PRE>
2.42      frystyk   459: <H3>
                    460:   Content Length
                    461: </H3>
2.18      frystyk   462: <PRE>
2.41      frystyk   463: extern long int HTAnchor_length        (HTParentAnchor * me);
                    464: extern void HTAnchor_setLength (HTParentAnchor * me, long int length);
                    465: extern void HTAnchor_addLength (HTParentAnchor * me, long int deltalength);
2.18      frystyk   466: </PRE>
2.42      frystyk   467: <H3>
2.44      frystyk   468:   Content MD5
                    469: </H3>
                    470: <PRE>
                    471: extern char * HTAnchor_md5     (HTParentAnchor * me);
2.49      frystyk   472: extern BOOL HTAnchor_setMd5    (HTParentAnchor * me, const char * hash);
2.44      frystyk   473: </PRE>
                    474: <H3>
2.42      frystyk   475:   Allowed methods (Allow)
                    476: </H3>
2.18      frystyk   477: <PRE>
2.49      frystyk   478: extern HTMethod HTAnchor_allow   (HTParentAnchor * me);
                    479: extern void HTAnchor_setAllow    (HTParentAnchor * me, HTMethod methodset);
                    480: extern void HTAnchor_appendAllow (HTParentAnchor * me, HTMethod methodset);
2.18      frystyk   481: </PRE>
2.42      frystyk   482: <H3>
                    483:   Version
                    484: </H3>
2.18      frystyk   485: <PRE>
2.35      frystyk   486: extern char * HTAnchor_version (HTParentAnchor * me);
2.37      frystyk   487: extern void HTAnchor_setVersion        (HTParentAnchor * me, const char * version);
2.28      frystyk   488: </PRE>
2.42      frystyk   489: <H3>
                    490:   Date
                    491: </H3>
                    492: <P>
2.28      frystyk   493: Returns the date that was registered in the RFC822 header "Date"
                    494: <PRE>
2.35      frystyk   495: extern time_t HTAnchor_date            (HTParentAnchor * me);
2.37      frystyk   496: extern void HTAnchor_setDate           (HTParentAnchor * me, const time_t date);
2.28      frystyk   497: </PRE>
2.42      frystyk   498: <H3>
                    499:   Last Modified Date
                    500: </H3>
                    501: <P>
2.28      frystyk   502: Returns the date that was registered in the RFC822 header "Last-Modified"
                    503: <PRE>
2.35      frystyk   504: extern time_t HTAnchor_lastModified    (HTParentAnchor * me);
2.37      frystyk   505: extern void HTAnchor_setLastModified   (HTParentAnchor * me, const time_t lm);
2.28      frystyk   506: </PRE>
2.42      frystyk   507: <H3>
2.44      frystyk   508:   Entity Tag
                    509: </H3>
                    510: <P>
                    511: Entity tags are used for comparing two or more entities from the same requested
                    512: resource. It is a cache validator much in the same way <I>Date</I> can be.
                    513: The difference is that we can't always trust the date and time stamp and
                    514: hence we must have something stronger.
                    515: <PRE>extern char * HTAnchor_etag       (HTParentAnchor * me);
                    516: extern void HTAnchor_setEtag   (HTParentAnchor * me, const char * etag);
                    517: extern BOOL HTAnchor_isEtagWeak        (HTParentAnchor * me);
                    518: </PRE>
                    519: <H3>
2.47      frystyk   520:   Age Header
                    521: </H3>
                    522: <P>
                    523: The <CODE>Age</CODE> response-header field conveys the sender's estimate
                    524: of the amount of time since the response (or its revalidation) was generated
                    525: at the origin server. A cached response is "fresh" if its age does not exceed
                    526: its freshness lifetime.
                    527: <PRE>
                    528: extern time_t HTAnchor_age    (HTParentAnchor * me);
                    529: extern void HTAnchor_setAge   (HTParentAnchor * me, const time_t age);
                    530: </PRE>
                    531: <H3>
2.42      frystyk   532:   Expires Date
                    533: </H3>
2.28      frystyk   534: <PRE>
2.35      frystyk   535: extern time_t HTAnchor_expires         (HTParentAnchor * me);
2.37      frystyk   536: extern void HTAnchor_setExpires                (HTParentAnchor * me, const time_t exp);
2.18      frystyk   537: </PRE>
2.42      frystyk   538: <H3>
                    539:   Derived from
                    540: </H3>
2.18      frystyk   541: <PRE>
2.35      frystyk   542: extern char * HTAnchor_derived (HTParentAnchor *me);
2.37      frystyk   543: extern void HTAnchor_setDerived        (HTParentAnchor *me, const char *derived_from);
2.18      frystyk   544: </PRE>
2.44      frystyk   545: <H2>
2.42      frystyk   546:   Status of Header Parsing
2.44      frystyk   547: </H2>
2.42      frystyk   548: <P>
2.47      frystyk   549: This is primarily for internal use. It is so that we can check whether the
                    550: header has been parsed or not.
2.49      frystyk   551: <PRE>
                    552: extern BOOL HTAnchor_headerParsed      (HTParentAnchor *me);
2.32      frystyk   553: extern void HTAnchor_setHeaderParsed   (HTParentAnchor *me);
2.7       timbl     554: </PRE>
2.49      frystyk   555: <H3>
                    556:   Original Response Headers
                    557: </H3>
                    558: <P>
                    559: The <A HREF="HTMIME.html">MIME parser</A> may add the original response headers
                    560: as (name,value) pairs.
                    561: <PRE>
                    562: extern BOOL HTAnchor_setHeader       (HTParentAnchor * me, HTAssocList * list);
                    563: extern HTAssocList * HTAnchor_header (HTParentAnchor * me);
                    564: </PRE>
2.18      frystyk   565: <PRE>
                    566: #endif /* HTANCHOR_H */
                    567: </PRE>
2.42      frystyk   568: <P>
                    569:   <HR>
2.39      frystyk   570: <ADDRESS>
2.58    ! frystyk   571:   @(#) $Id: HTAnchor.html,v 2.57 1998/05/14 02:10:13 frystyk Exp $
2.39      frystyk   572: </ADDRESS>
2.42      frystyk   573: </BODY></HTML>

Webmaster