Annotation of libwww/Library/src/HTBind.html, revision 2.11
2.1 frystyk 1: <HTML>
2: <HEAD>
2.9 frystyk 3: <TITLE>W3C Reference Library libwww File Suffix Binding</TITLE>
2.11 ! frystyk 4: <!-- Changed by: Henrik Frystyk Nielsen, 15-Apr-1996 -->
2.1 frystyk 5: </HEAD>
6: <BODY>
7:
8: <H1>File Suffix Bind Manager</H1>
9:
10: <PRE>
11: /*
12: ** (c) COPYRIGHT MIT 1995.
13: ** Please first read the full copyright statement in the file COPYRIGH.
14: */
15: </PRE>
16:
17: This module sets up the binding between a file Bind and a media type,
18: language, encoding etc. In a client application the Binds are used in
19: protocols that does not support media types etc., like FTP, and in
20: server applications they are used to make the bindings between the
21: server and the local file store that the server can serve to the rest
22: of the world (well almost). The <A HREF="HTFormat.html">HTFormat
23: module</A> holds this information against the accept headers received
24: in a request and uses if for format negotiation. All the binding
25: management can all be replace by a database interface. <P>
26:
27: This module is implemented by <A HREF="HTBind.c">HTBind.c</A>, and it
2.6 frystyk 28: is a part of the <A HREF="http://www.w3.org/pub/WWW/Library/"> W3C
29: Reference Library</A>.
2.1 frystyk 30:
31: <PRE>
32: #ifndef HTBIND_H
33: #define HTBIND_H
34:
35: #include "HTFormat.h"
36: #include "HTAnchor.h"
37: </PRE>
38:
39: <H2>Initialization of the Module</H2>
40:
41: These functions must be called on startup and termination of the
42: application. This is done automatically by <A
2.5 frystyk 43: HREF="HTReq.html#Library">HTLibInit() and HTLibTerminate()</A>.
2.1 frystyk 44:
45: <PRE>
2.6 frystyk 46: extern BOOL HTBind_init (void);
47: extern BOOL HTBind_deleteAll (void);
2.1 frystyk 48: </PRE>
49:
50: <H2>Case Sensitivity</H2>
51:
52: Should the search for suffixes be case sensitive or not? The default
53: value is <EM>case sensitive</EM>.
54:
55: <PRE>
2.6 frystyk 56: extern void HTBind_caseSensitive (BOOL sensitive);
2.1 frystyk 57: </PRE>
58:
59: <H2>Suffix Delimiters</H2>
60:
61: Change the set of suffix delimiters. The default is a platform
2.8 frystyk 62: dependent set defined in the <A HREF="sysdep.html">tcp module</A>.
2.1 frystyk 63:
64: <PRE>
2.8 frystyk 65: extern const char *HTBind_delimiters (void);
66: extern void HTBind_setDelimiters (const char * new_suffixes);
2.1 frystyk 67: </PRE>
68:
69: <H2>Set up Bindings Associated with a File Suffix</H2>
70:
2.10 frystyk 71: There are four types of bindings:
2.1 frystyk 72:
73: <UL>
74: <LI>Content Type (media type)
75: <LI>Language
76: <LI>Content Encoding
2.10 frystyk 77: <LI>Content Transfer Encoding
2.1 frystyk 78: </UL>
79:
80: And the associated set of methods is defined as:
81:
82: <PRE>
2.8 frystyk 83: extern BOOL HTBind_add (const char * suffix,
84: const char * representation,
85: const char * encoding,
2.10 frystyk 86: const char * transfer,
2.8 frystyk 87: const char * language,
2.6 frystyk 88: double value);
89:
2.8 frystyk 90: extern BOOL HTBind_addType (const char * suffix,
91: const char * format,
2.6 frystyk 92: double value);
93:
2.8 frystyk 94: extern BOOL HTBind_addEncoding (const char * suffix,
95: const char * encoding,
2.6 frystyk 96: double value);
97:
2.10 frystyk 98: extern BOOL HTBind_addTransfer (const char * suffix,
99: const char * transfer,
100: double value);
101:
2.8 frystyk 102: extern BOOL HTBind_addLanguage (const char * suffix,
103: const char * language,
2.6 frystyk 104: double value);
2.1 frystyk 105: </PRE>
106:
107: The first method is a "super" method for binding information to a file
108: suffic. Any of the string values can be <CODE>NULL</CODE>. If filename
109: suffix is already defined its previous definition is overridden or
110: modified. For example, a <CODE>HTBind_setType</CODE> and
111: <CODE>HTBind_setEncoding</CODE> can be called with the same suffix.<P>
112:
113: Calling this with suffix set to "*" will set the default
114: representation. Calling this with suffix set to "*.*" will set the
115: default representation for unknown suffix files which contain a "." <P>
116:
117: <B>NOTE:</B> The suffixes <EM>can</EM> contain characters that must be
118: escaped in a URL. However, they should <EM>not</EM> be encoded when
119: parsed as the <CODE>suffix</CODE> parameter.
120:
121: <H2>Determine a suitable suffix</H2>
122:
123: Use the set of bindings to find a suitable suffix (or index) for a
124: certain combination of language, media type and encoding given in the
125: anchor. Returns a pointer to a suitable suffix string that must be freed
126: by the caller. If more than one suffix is found they are all
127: concatenated. If no suffix is found, NULL is returned.
128:
129: <PRE>
2.6 frystyk 130: extern char * HTBind_getSuffix (HTParentAnchor * anchor);
2.1 frystyk 131: </PRE>
132:
133:
134: <H2>Determine the content of an Anchor</H2>
135:
136: Use the set of bindings to find the combination of language, media
137: type and encoding of a given anchor. If more than one suffix is found
138: they are all searched. The last suffix has highest priority, the first
139: one lowest. Returns the anchor object with the representations
140: found. See also <CODE>HTBind_getFormat</CODE>
141:
142: <PRE>
2.6 frystyk 143: extern BOOL HTBind_getBindings (HTParentAnchor * anchor);
2.1 frystyk 144: </PRE>
145:
146: <H2>Determine the content of File</H2>
147:
148: Use the set of bindings to find the combination of language, media
149: type and encoding of a given anchor. If more than one suffix is found
150: they are all searched. The last suffix has highest priority, the first
151: one lowest. Returns the format, encoding, and language found. See also
152: <CODE>HTBind_getBindings</CODE>.
153:
154: <PRE>
2.10 frystyk 155: extern BOOL HTBind_getFormat (const char * filename,
156: HTFormat * format,
157: HTEncoding * enc,
2.11 ! frystyk 158: HTEncoding * cte,
2.10 frystyk 159: HTLanguage * lang,
160: double * quality);
2.1 frystyk 161: </PRE>
162:
163: <H2>Multi Format Management</H2>
164:
165: Use the set of bindings to find the combination of language, media
166: type and encoding of a given anchor. If more than one suffix is found
167: they are all searched. The last suffix has highest priority, the first
168: one lowest. Returns the format, encoding, and language found. See also
169: <CODE>HTBind_getBindings</CODE>, and <CODE>HTBind_getFormat</CODE>.
170:
171: <PRE>
172: #define MULTI_SUFFIX ".multi" /* Extension for scanning formats */
173: #define MAX_SUFF 15 /* Maximum number of suffixes for a file */
174:
2.6 frystyk 175: extern HTContentDescription * HTBind_getDescription (char * file);
2.1 frystyk 176: </PRE>
177:
178: End of declaration module
179:
180: <PRE>
181: #endif /* HTBIND_H */
182: </PRE>
183:
2.10 frystyk 184: <HR>
185: <ADDRESS>
2.11 ! frystyk 186: @(#) $Id: HTBind.html,v 2.10 1996/04/12 17:46:05 frystyk Exp $
2.10 frystyk 187: </ADDRESS>
2.1 frystyk 188: </BODY>
189: </HTML>
Webmaster