libdap++  Updated for version 3.8.2
mime_util.h
Go to the documentation of this file.
00001 
00002 // -*- mode: c++; c-basic-offset:4 -*-
00003 
00004 // This file is part of libdap, A C++ implementation of the OPeNDAP Data
00005 // Access Protocol.
00006 
00007 // Copyright (c) 2002,2003 OPeNDAP, Inc.
00008 // Author: James Gallagher <jgallagher@opendap.org>
00009 //
00010 // This library is free software; you can redistribute it and/or
00011 // modify it under the terms of the GNU Lesser General Public
00012 // License as published by the Free Software Foundation; either
00013 // version 2.1 of the License, or (at your option) any later version.
00014 //
00015 // This library is distributed in the hope that it will be useful,
00016 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018 // Lesser General Public License for more details.
00019 //
00020 // You should have received a copy of the GNU Lesser General Public
00021 // License along with this library; if not, write to the Free Software
00022 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00023 //
00024 // You can contact OPeNDAP, Inc. at PO Box 112, Saunderstown, RI. 02874-0112.
00025 
00026 // (c) COPYRIGHT URI/MIT 1995-1999
00027 // Please read the full copyright statement in the file COPYRIGHT_URI.
00028 //
00029 // Authors:
00030 //      jhrg,jimg       James Gallagher <jgallagher@gso.uri.edu>
00031 //      reza            Reza Nekovei <reza@intcomm.net>
00032 
00033 // External definitions for utility functions used by servers.
00034 //
00035 // 2/22/95 jhrg
00036 
00037 #ifndef _mime_util_h
00038 #define _mime_util_h
00039 
00040 #ifndef _dds_h
00041 #include "DDS.h"
00042 #endif
00043 
00044 #ifndef _object_type_h
00045 #include "ObjectType.h"
00046 #endif
00047 
00048 #ifndef _encoding_type_h
00049 #include "EncodingType.h"
00050 #endif
00051 
00052 namespace libdap
00053 {
00054 
00071 string rfc822_date(const time_t t);
00072 time_t last_modified_time(const string &name);
00073 ObjectType get_description_type(const string &value);
00074 bool is_boundary(const char *line, const string &boundary);
00075 string cid_to_header_value(const string &cid);
00076 string read_multipart_boundary(FILE *in, const string &boundary = "");
00077 void parse_mime_header(const string &header, string &name, string &value);
00078 string name_path(const string &path);
00079 
00080 // All of these are deprecated
00081 bool do_version(const string &script_ver, const string &dataset_ver);
00082 void ErrMsgT(const string &Msgt);
00083 ObjectType get_type(const string &value); // deprecated
00084 bool remove_mime_header(FILE *in);
00085 string get_next_mime_header(FILE *in);
00086 bool found_override(string name, string &doc);
00088 
00101 void set_mime_text(FILE *out, ObjectType type = unknown_type,
00102                    const string &version = "", EncodingType enc = x_plain,
00103                    const time_t last_modified = 0);
00104 void set_mime_text(ostream &out, ObjectType type = unknown_type,
00105                    const string &version = "", EncodingType enc = x_plain,
00106                    const time_t last_modified = 0);
00107 
00108 void set_mime_html(FILE *out, ObjectType type = unknown_type,
00109                    const string &version = "", EncodingType enc = x_plain,
00110                    const time_t last_modified = 0);
00111 void set_mime_html(ostream &out, ObjectType type = unknown_type,
00112                    const string &version = "", EncodingType enc = x_plain,
00113                    const time_t last_modified = 0);
00114 
00115 void set_mime_binary(FILE *out, ObjectType type = unknown_type,
00116                      const string &version = "", EncodingType enc = x_plain,
00117                      const time_t last_modified = 0);
00118 void set_mime_binary(ostream &out, ObjectType type = unknown_type,
00119                      const string &version = "", EncodingType enc = x_plain,
00120                      const time_t last_modified = 0);
00121 
00122 void set_mime_multipart(ostream &out, const string &boundary,
00123         const string &start, ObjectType type = unknown_type,
00124         const string &version = "", EncodingType enc = x_plain,
00125         const time_t last_modified = 0);
00126 
00127 void set_mime_ddx_boundary(ostream &out, const string &boundary,
00128         const string &start, ObjectType type = unknown_type,
00129         EncodingType enc = x_plain);
00130 
00131 void set_mime_data_boundary(ostream &out, const string &boundary,
00132         const string &cid, ObjectType type = unknown_type,
00133         EncodingType enc = x_plain);
00134 
00135 void read_multipart_headers(FILE *in, const string &content_type,
00136         const ObjectType object_type, const string &cid = "");
00137 
00138 void set_mime_error(FILE *out, int code = 404,
00139                     const string &reason = "Dataset not found",
00140                     const string &version = "");
00141 void set_mime_error(ostream &out, int code = 404,
00142                     const string &reason = "Dataset not found",
00143                     const string &version = "");
00144 
00145 void set_mime_not_modified(FILE *out);
00146 void set_mime_not_modified(ostream &out);
00147 
00148 
00150 
00151 } // namespace libdap
00152 
00153 #endif // _mime_util_h