File:  [Public] / libwww / Library / src / HTMIMPrs.html
Revision 2.8: download - view: text, annotated - select for diffs
Thu May 14 02:10:42 1998 UTC (26 years ago) by frystyk
Branches: MAIN
CVS tags: repeat-requests, before_webdav, Release-5-4-0, Release-5-3-1, Release-5-2-8, Release-5-2-6, Release-5-2, Release-5-1m, HEAD, Before-New-Trace-Messages, Amaya_2_4, Amaya-6-3, Amaya-6-1, Amaya-5-2, Amaya-4-3-2, Amaya-4-3-1, Amaya-4-3, Amaya-4-1-2, Amaya-4-1-0, Amaya-4-0-0, Amaya-3-2-1, Amaya-3-2, Amaya
Changing old pub/WWW links

<HTML>
<HEAD>
  <!-- Changed by: Eric Prud'hommeaux, 30-May-1996 -->
  <TITLE>W3C Sample Code Library libwww MIME header parser managment</TITLE>
</HEAD>
<BODY>
<H1>
  MIMEParseSet
</H1>
<PRE>
/*
**	(c) COPYRIGHT MIT 1996.
**	Please first read the full copyright statement in the file COPYRIGH.
*/
</PRE>
<P>
A MIME<CODE>ParseSet</CODE> associates simple and regex MIME header tokens
with <A HREF="HTHeader.html">parsers</A>. Regex tokens are stored in a list,
while simple tokens are stored in a hashed list for quick access.
<P>
This module is implemented by <A HREF="HTMIMPrs.c">HTMIMPrs.c</A>, and it
is a part of the <A HREF="http://www.w3.org/Library/"> W3C Sample Code
Library</A>.
<P>
<PRE>
#ifndef HTMIMPRS_H
#define HTMIMPRS_H

#include "HTHeader.h"

</PRE>
<H2>
  Data Types
</H2>
<P>
The HTMIMEParseSet contains all registered MIME parses. There are regex parsers,
which are stored in a list of HTMIMEParseEl, and simple (no wildcards) parsers
stored in a hashed array of lists of HTMIMEParseEl.
<PRE>
typedef struct _HTMIMEParseEl HTMIMEParseEl;

struct _HTMIMEParseSet {
    int size;
    HTMIMEParseEl ** parsers;
    HTMIMEParseEl * regexParsers;
};

#define MIMEParseSet_NULL {0, NULL, NULL}
</PRE>
<H2>
  Public Functions
</H2>
<P>
The following methods are available for this HTMIMEParseSets:
<H3>
  Create and destroy<CODE>HashLists</CODE>
</H3>
<PRE>
extern HTMIMEParseSet * HTMIMEParseSet_new(int hashSize);
extern int HTMIMEParseSet_deleteAll (HTMIMEParseSet * me);
</PRE>
<H3>
  Add and remove parsers
</H3>
<P>
Register a Header parser to be called if we encounter the token in the protocol
response. Tokens can contain a wildcard '*' which will match zero or more
arbritary chars.
<P>
<PRE>
extern HTMIMEParseEl * HTMIMEParseSet_add (HTMIMEParseSet * me, 
					   const char * token, 
					   BOOL caseSensitive, 
					   HTParserCallback * callback);
extern HTMIMEParseEl * HTMIMEParseSet_addRegex (HTMIMEParseSet * me, 
						const char * token, 
						BOOL caseSensitive, 
						HTParserCallback * callback);
extern int HTMIMEParseSet_delete (HTMIMEParseSet * me, const char * token);
</PRE>
<H3>
  Execute these parsers
</H3>
<P>
Find <CODE>HTParserCallback</CODE> which matches the string.
<PRE>
extern int HTMIMEParseSet_dispatch (HTMIMEParseSet * me, HTRequest * request, 
				    char * token, char * value, BOOL * pFound);
</PRE>
<PRE>
#endif /* HTMIMPRS_H */
</PRE>
<P>
  <HR>
<ADDRESS>
  @(#) $Id: HTMIMPrs.html,v 2.8 1998/05/14 02:10:42 frystyk Exp $
</ADDRESS>
</BODY></HTML>

Webmaster