libdap++  Updated for version 3.8.2
mime_util.h
Go to the documentation of this file.
1 
2 // -*- mode: c++; c-basic-offset:4 -*-
3 
4 // This file is part of libdap, A C++ implementation of the OPeNDAP Data
5 // Access Protocol.
6 
7 // Copyright (c) 2002,2003 OPeNDAP, Inc.
8 // Author: James Gallagher <jgallagher@opendap.org>
9 //
10 // This library is free software; you can redistribute it and/or
11 // modify it under the terms of the GNU Lesser General Public
12 // License as published by the Free Software Foundation; either
13 // version 2.1 of the License, or (at your option) any later version.
14 //
15 // This library is distributed in the hope that it will be useful,
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 // Lesser General Public License for more details.
19 //
20 // You should have received a copy of the GNU Lesser General Public
21 // License along with this library; if not, write to the Free Software
22 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 //
24 // You can contact OPeNDAP, Inc. at PO Box 112, Saunderstown, RI. 02874-0112.
25 
26 // (c) COPYRIGHT URI/MIT 1995-1999
27 // Please read the full copyright statement in the file COPYRIGHT_URI.
28 //
29 // Authors:
30 // jhrg,jimg James Gallagher <jgallagher@gso.uri.edu>
31 // reza Reza Nekovei <reza@intcomm.net>
32 
33 // External definitions for utility functions used by servers.
34 //
35 // 2/22/95 jhrg
36 
37 #ifndef _mime_util_h
38 #define _mime_util_h
39 
40 #ifndef _dds_h
41 #include "DDS.h"
42 #endif
43 
44 #ifndef _object_type_h
45 #include "ObjectType.h"
46 #endif
47 
48 #ifndef _encoding_type_h
49 #include "EncodingType.h"
50 #endif
51 
52 namespace libdap
53 {
54 
71 string rfc822_date(const time_t t);
72 time_t last_modified_time(const string &name);
73 ObjectType get_description_type(const string &value);
74 bool is_boundary(const char *line, const string &boundary);
75 string cid_to_header_value(const string &cid);
76 string read_multipart_boundary(FILE *in, const string &boundary = "");
77 void parse_mime_header(const string &header, string &name, string &value);
78 string name_path(const string &path);
79 
80 // All of these are deprecated
81 bool do_version(const string &script_ver, const string &dataset_ver);
82 void ErrMsgT(const string &Msgt);
83 ObjectType get_type(const string &value); // deprecated
84 bool remove_mime_header(FILE *in);
85 string get_next_mime_header(FILE *in);
86 bool found_override(string name, string &doc);
88 
101 void set_mime_text(FILE *out, ObjectType type = unknown_type,
102  const string &version = "", EncodingType enc = x_plain,
103  const time_t last_modified = 0);
104 void set_mime_text(ostream &out, ObjectType type = unknown_type,
105  const string &version = "", EncodingType enc = x_plain,
106  const time_t last_modified = 0);
107 
108 void set_mime_html(FILE *out, ObjectType type = unknown_type,
109  const string &version = "", EncodingType enc = x_plain,
110  const time_t last_modified = 0);
111 void set_mime_html(ostream &out, ObjectType type = unknown_type,
112  const string &version = "", EncodingType enc = x_plain,
113  const time_t last_modified = 0);
114 
115 void set_mime_binary(FILE *out, ObjectType type = unknown_type,
116  const string &version = "", EncodingType enc = x_plain,
117  const time_t last_modified = 0);
118 void set_mime_binary(ostream &out, ObjectType type = unknown_type,
119  const string &version = "", EncodingType enc = x_plain,
120  const time_t last_modified = 0);
121 
122 void set_mime_multipart(ostream &out, const string &boundary,
123  const string &start, ObjectType type = unknown_type,
124  const string &version = "", EncodingType enc = x_plain,
125  const time_t last_modified = 0);
126 
127 void set_mime_ddx_boundary(ostream &out, const string &boundary,
128  const string &start, ObjectType type = unknown_type,
129  EncodingType enc = x_plain);
130 
131 void set_mime_data_boundary(ostream &out, const string &boundary,
132  const string &cid, ObjectType type = unknown_type,
133  EncodingType enc = x_plain);
134 
135 void read_multipart_headers(FILE *in, const string &content_type,
136  const ObjectType object_type, const string &cid = "");
137 
138 void set_mime_error(FILE *out, int code = 404,
139  const string &reason = "Dataset not found",
140  const string &version = "");
141 void set_mime_error(ostream &out, int code = 404,
142  const string &reason = "Dataset not found",
143  const string &version = "");
144 
145 void set_mime_not_modified(FILE *out);
146 void set_mime_not_modified(ostream &out);
147 
148 
150 
151 } // namespace libdap
152 
153 #endif // _mime_util_h