libdap Namespace Reference

top level DAP object to house generic methods More...

## Classes

class | AlarmHandler
class | Ancillary
class | Array
| A multidimensional array of identical data types. More...
class | AttrTable
| Contains the attributes for a dataset. More...
class | BaseType
| The basic data type for the DODS DAP types. More...
class | BaseTypeFactory
class | Byte
| Holds a single byte. More...
struct | ce_parser_arg
class | ChildLocker
class | chunked_inbuf
class | chunked_istream
class | chunked_ostream

A C++ stream class for chunked data. This class uses the chunked_outbuf class to provide for chunked binary serialization of data as specified by DAP4. Information to be serialized is broken into 'chunks' that are no more than 2^24 bytes in length. Each chunk is prefixed by a 4 byte header that indicates the type of chunk and size (number of bytes in the chunk body). There are three types of chunk: Data; End; and Error. In normal operation, a DAP4 data document/response is serialized as a sequence of DATA chunks followed by one END chunk (which may be zero bytes in length). If, during serialization, an error is detected, the currently buffered (but not sent) data are discarded and an ERROR chunk is sent with an error message. More...

class | chunked_outbuf

output buffer for a chunked stream This performs buffered output encoding the data in the stream using the simple chunking protocol defined for DAP4's binary data transmission. Each block of data is prefixed by four bytes: A CHUNK TYPE byte followed by three bytes that are the CHUNK SIZE. There are three CHUNK TYPES: data, end and error, indicated by the code values 0x00, 0x01 and 0x02. The size of a chunk is limited to 2^24 data bytes + 4 bytes for the chunk header. More...

struct | Clause
| Holds a fragment of a constraint expression. More...
class | Connect
| Holds information about the link from a DAP2 client to a dataset. More...
class | ConstraintEvaluator
| Evaluate a constraint expression. More...
class | Constructor
class | D4AsyncUtil
class | D4Attribute
class | D4Attributes
class | D4BaseTypeFactory
class | D4CEScanner
class | D4Connect
class | D4ConstraintEvaluator
class | D4Dimension
class | D4Dimensions
class | D4Enum
| Holds a DAP4 enumeration. More...
class | D4EnumDef
class | D4EnumDefs
class | D4FilterClause
| DAP4 filter clauses. More...
class | D4FilterClauseList
| List of DAP4 Filter Clauses. More...
class | D4FunctionEvaluator
class | D4FunctionScanner
class | D4Group
class | D4Map
class | D4Maps
class | D4Opaque
class | D4ParserSax2
class | D4RValue
class | D4RValueList
class | D4Sequence
| Holds a sequence. More...
class | D4StreamMarshaller
| Marshaller that knows how to marshal/serialize dap data objects to a C++ iostream using DAP4's receiver-makes-right scheme. This code adds checksums to the stream and uses the xdr library to encode real values if the underlying representation is not IEEE 754. It also supports computing the checksum only. More...
class | D4StreamUnMarshaller
| Read data from the stream made by D4StreamMarshaller. More...
class | DapIndent
| class with static methods to help with indentation of debug information. More...
class | DapObj
| libdap base object for common functionality of libdap objects More...
class | DapXmlNamspaces
class | DAS
| Hold attribute data for a DAP2 dataset. More...
class | DataDDS
| Holds a DAP2 DDS. More...
class | DDS
class | DDXParseFailed
class | DDXParser
class | DMR
class | DODSFilter
| Common functions for DODS server filter programs. More...
class | Error
| A class for error processing. More...
class | EventHandler
class | Float32
| Holds a 32-bit floating point value. More...
class | Float64
| Holds a 64-bit (double precision) floating point value. More...
class | Grid
| Holds the Grid data type. More...
class | HTTPCache
class | HTTPCacheInterruptHandler
class | HTTPCacheResponse
class | HTTPCacheTable
class | HTTPConnect
class | HTTPResponse
class | Int16
| Holds a 16-bit signed integer value. More...
class | Int32
| Holds a 32-bit signed integer. More...
class | Int64
| Holds a64-bit signed integer. More...
class | Int8
| Holds an 8-bit signed integer value. More...
class | InternalErr
| A class for software fault reporting. More...
class | Keywords
class | Locker
class | Marshaller
| abstract base class used to marshal/serialize dap data objects More...
class | MarshallerThread
struct | parser_arg
| Pass parameters by reference to a parser. More...
class | PipeResponse
| Encapsulate a response. This class provides special treatment for 'stream pipes.' It arranges to close them using pclose() instead of fclose(). More...
class | RCReader
class | Regex
| Regular expression matching. More...
class | Resource
| Associate a rule with an ancillary resource. More...
class | Response
class | ResponseTooBigErr
class | rvalue
class | Sequence
| Holds a sequence. More...
class | ServerFunction
class | ServerFunctionsList
class | SignalHandler
class | SignalHandlerRegisteredErr
class | StdinResponse
| Encapsulate a response read from stdin. More...
class | Str
| Holds character string data. More...
class | Structure
| Holds a structure (aggregate) type. More...
class | UInt16
| Holds an unsigned 16-bit integer. More...
class | UInt32
| Holds a 32-bit unsigned integer. More...
class | UInt64
| Holds a 64-bit unsigned integer. More...
class | UnMarshaller
| abstract base class used to unmarshall/deserialize dap data objects More...
class | Url
| Holds an Internet address (URL). More...
class | Vector
| Holds a one-dimensional collection of DAP2 data types. More...
class | XDRFileMarshaller
| marshaller that knows how to marshall/serialize dap data objects to a file using XDR More...
class | XDRFileUnMarshaller
| unmarshaller that knows how to unmarshall/deserialize dap objects using XDR from a file More...
class | XDRStreamMarshaller
| Marshaller that knows how serialize dap data objects to a C++ iostream using XDR. More...
class | XDRStreamUnMarshaller
| unmarshaller that knows how to unmarshall/deserialize dap objects using XDR from a file More...
class | XDRUtils
class | XMLWriter

## Typedefs

typedef vector< BaseType * > | BaseTypeRow
typedef std::vector< dods_byte > * | byte_arg_list
typedef BaseType *(* | D4Function) (D4RValueList *, DMR &)
typedef vector< BaseType * > | D4SeqRow
typedef vector< D4SeqRow * > | D4SeqValues
typedef uint8_t | dods_byte
typedef int64_t | dods_enum
typedef float | dods_float32
typedef double | dods_float64
typedef int16_t | dods_int16
typedef int32_t | dods_int32
typedef int64_t | dods_int64
typedef int8_t | dods_int8
typedef uint16_t | dods_uint16
typedef uint32_t | dods_uint32
typedef uint64_t | dods_uint64
typedef int | ErrorCode
| An enumerated type for common errors.
typedef std::vector< dods_float32 > * | float32_arg_list
typedef std::vector< dods_float64 > * | float64_arg_list
typedef std::vector< dods_int16 > * | int16_arg_list
typedef std::vector< dods_int32 > * | int32_arg_list
typedef std::vector< rvalue * > | rvalue_list
typedef std::vector< rvalue * >::const_iterator | rvalue_list_citer
typedef std::vector< rvalue * >::iterator | rvalue_list_iter
typedef vector< BaseTypeRow * > | SequenceValues
typedef void | Sigfunc(int)
typedef std::vector< dods_uint16 > * | uint16_arg_list
typedef std::vector< dods_uint32 > * | uint32_arg_list

## Enumerations

enum | AttrType { Attr_unknown , Attr_container , Attr_byte , Attr_int16 , Attr_uint16 , Attr_int32 , Attr_uint32 , Attr_float32 , Attr_float64 , Attr_string , Attr_url , Attr_other_xml , Attr_int8 , Attr_uint8 , Attr_int64 , Attr_uint64 , Attr_enum , Attr_opaque }
enum | CacheDisconnectedMode { DISCONNECT_NONE = 0 , DISCONNECT_NORMAL = 1 , DISCONNECT_EXTERNAL = 2 }
enum | DAPVersion { DAP_2_0 , DAP_3_2 , DAP_4_0 }
enum | EncodingType { unknown_enc , deflate , x_plain , gzip , binary }
| The type of encoding used on the current stream. More...
enum | ObjectType { unknown_type , dods_das , dods_dds , dods_data , dods_ddx , dods_data_ddx , dods_error , web_error , dap4_dmr , dap4_data , dap4_error }
| The type of object in the stream coming from the data server. More...
enum | Part { nil , array , maps }
| Names the parts of multi-section constructor data types. More...
enum | RejectReasonCode { TIME , UNAVAILABLE , PRIVILEGES , OTHER }
enum | Type { dods_null_c , dods_byte_c , dods_int16_c , dods_uint16_c , dods_int32_c , dods_uint32_c , dods_float32_c , dods_float64_c , dods_str_c , dods_url_c , dods_structure_c , dods_array_c , dods_sequence_c , dods_grid_c , dods_char_c , dods_int8_c , dods_uint8_c , dods_int64_c , dods_uint64_c , dods_enum_c , dods_opaque_c , dods_group_c }
| Identifies the data type. More...

## Functions

string | add_space_encoding (const string &s)
rvalue_list * | append_rvalue_list (rvalue_list *rvals, rvalue *rv)
string | AttrType_to_String (const AttrType at)
BaseType ** | build_btp_args (const rvalue_list *args, DDS &dds)
string | char2ASCII (string s, const string escape="%[0-7][0-9a-fA-F]")
int | check_byte (const char *val)
| Is the value a valid byte?
int | check_float32 (const char *val)
int | check_float64 (const char *val)
int | check_float64 (const char *val, double &v)
int | check_int16 (const char *val)
int | check_int32 (const char *val)
int | check_int32 (const char *val, int &v)
int | check_int64 (const char *val)
int | check_uint16 (const char *val)
int | check_uint32 (const char *val)
int | check_uint32 (const char *val, unsigned int &v)
int | check_uint64 (const char *val)
int | check_url (const char *val)
| Is the value a valid URL?
void | close_temp (FILE *s, const string &name)
template<class T1 , class T2 >
bool | Cmp (int op, T1 v1, T2 v2)
string | D2type_name (Type t)
| Returns the type of the class instance as a string. Supports all DAP2 types and not the DAP4-only types. Also returns Url (DAP2) and not "URL" (DAP4) for the URL type.
string | D4AttributeTypeToString (D4AttributeType at)
D4RValue * | D4RValueFactory (std::string cpps)
| Build an appropriate RValue.
string | D4type_name (Type t)
| Returns the type of the class instance as a string. Supports all DAP4 types and not the DAP2-only types. Also returns URL (DAP4) and not "Url" (DAP2) for the URL type.
string | date_time_str (time_t *calendar, bool local)
bool | dir_exists (const string &dir)
bool | double_eq (double lhs, double rhs, double epsilon=1.0e-5)
void | downcase (string &s)
string | esc2underscore (string s)
string | escape_double_quotes (string source)
string | escattr (string s)
string | escattr_xml (string s)
double * | extract_double_array (Array *a)
void | extract_double_array (Array *a, vector< double > &dest)
double | extract_double_value (BaseType *arg)
string | extract_string_argument (BaseType *arg)
void | fillConstructorAttrTable (AttrTable *at, BaseType *bt)
| Recursive helper function for Building DAS entries for Constructor types.
AttrType | get_dap2_AttrType (D4AttributeType d4_type)
string | get_dims_decl (Array &a)
double | get_float64 (const char *val)
int | get_hash (const string &url)
int | get_int32 (const char *val)
long long | get_int64 (const char *val)
string | get_temp_file (FILE *&stream) throw (Error)
Type | get_type (const char *name)
unsigned int | get_uint32 (const char *val)
unsigned long long | get_uint64 (const char *val)
bool | has_dap2_attributes (AttrTable &a)
bool | has_dap2_attributes (BaseType *btp)
string | hexstring (unsigned char val)
string | id2www (string in, const string &allowable)
string | id2www_ce (string in, const string &allowable)
string | id2xml (string in, const string &not_allowed)
bool | is_constructor_type (Type t)
| Returns true if the instance is a constructor (i.e., Structure, Sequence or Grid) type variable.
bool | is_host_big_endian ()
| Does this host use big-endian byte order?
bool | is_integer_type (Type t)
bool | is_keyword (string id, const string &keyword)
bool | is_quoted (const string &s)
bool | is_simple_type (Type t)
| Returns true if the instance is a numeric, string or URL type variable.
bool | is_vector_type (Type t)
| Returns true if the instance is a vector (i.e., array) type variable.
const char * | libdap_name ()
const char * | libdap_root ()
const char * | libdap_version ()
rvalue_list * | make_rvalue_list (rvalue *rv)
string | munge_error_message (string msg)
string | octal_to_hex (const string &octal_digits)
string | octstring (unsigned char val)
void | parse_error (const char *msg, const int line_num, const char *context)
void | print_var_das (ostream &out, BaseType *bt, string indent="")
string | prune_spaces (const string &name)
string | remove_quotes (const string &s)
string | remove_space_encoding (const string &s)
void | save_str (std::string &dst, const char *src, const int)
| Save a string to a temporary variable during the parse.
void | set_array_using_double (Array *dest, double *src, int src_len)
template<class T1 , class T2 >
bool | StrCmp (int op, T1 v1, T2 v2)
AttrType | String_to_AttrType (const string &s)
D4AttributeType | StringToD4AttributeType (string s)
string | systime ()
string | type_name (Type t)
string | unescape_double_quotes (string source)
string | unescattr (string s)
string | unhexstring (string s)
bool | unique_names (vector< BaseType * > l, const string &var_name, const string &type_name, string &msg)
string | unoctstring (string s)
string | www2id (const string &in, const string &escape, const string &except)
string | xml2id (string in)
Accessors and Mutators for various properties.
bool | is_hop_by_hop_header (const string &header)
Cache Index
These methods manage the cache's index file. Each cache holds an index file named ``.index which stores the cache's state information.
MIME Utilities

A collection of useful functions for writing MIME headers for OPeNDAP servers.

The CGI utilities include a variety of functions useful to programmers developing OPeNDAP CGI filter programs. However, before jumping in and using these, look at the class ResponseBuilder. Always choose to use that class over these functions if you can. Many of these functions were used by the CGI programs that made up the first DAP server; all of those are deprecated and the ResponseBuilder class should be used instead. Some of the other functions are used by ResponseBuilder and the client-side parsing code that needs to identify MIME headers, boundaries, etc.

See also
  ResponseBuilder, Connect, DDXParserSAX2

time_t | last_modified_time (const string &name)
string | rfc822_date (const time_t t)
bool | do_version (const string &script_ver, const string &dataset_ver)
| Send a version number.
void | ErrMsgT (const string &Msgt)
| Logs an error message.
string | name_path (const string &path)
| Returns the filename portion of a pathname.
ObjectType | get_type (const string &value)
ObjectType | get_description_type (const string &value)
string | get_next_mime_header (FILE *in)
string | get_next_mime_header (istream &in)
void | parse_mime_header (const string &header, string &name, string &value)
bool | is_boundary (const char *line, const string &boundary)
string | read_multipart_boundary (FILE *in, const string &boundary)
string | read_multipart_boundary (istream &in, const string &boundary)
void | read_multipart_headers (FILE *in, const string &content_type, const ObjectType object_type, const string &cid)
void | read_multipart_headers (istream &in, const string &content_type, const ObjectType object_type, const string &cid)
string | cid_to_header_value (const string &cid)
bool | remove_mime_header (FILE *in)
| Read and discard the MIME header of the stream `in`.
void | remove_mime_header (istream &in)
MIME utility functions

These functions are used to create the MIME headers for a message from a server to a client. They are public but should not be called directly unless absolutely necessary. Use DODSFilter instead.

NB: These functions actually write both the response status line and the header.

Deprecated:
  Use ResponseBuilder instead.

See also
  DODSFilter

void | set_mime_text (FILE *out, ObjectType type, const string &ver, EncodingType enc, const time_t last_modified)
void | set_mime_text (ostream &strm, ObjectType type, const string &ver, EncodingType enc, const time_t last_modified)
void | set_mime_text (ostream &strm, ObjectType type, EncodingType enc, const time_t last_modified, const string &protocol)
void | set_mime_html (FILE *out, ObjectType type, const string &ver, EncodingType enc, const time_t last_modified)
void | set_mime_html (ostream &strm, ObjectType type, const string &ver, EncodingType enc, const time_t last_modified)
void | set_mime_html (ostream &strm, ObjectType type, EncodingType enc, const time_t last_modified, const string &protocol)
void | set_mime_binary (FILE *out, ObjectType type, const string &ver, EncodingType enc, const time_t last_modified)
void | set_mime_binary (ostream &strm, ObjectType type, const string &ver, EncodingType enc, const time_t last_modified)
void | set_mime_binary (ostream &strm, ObjectType type, EncodingType enc, const time_t last_modified, const string &protocol)
void | set_mime_multipart (ostream &strm, const string &boundary, const string &start, ObjectType type, const string &version, EncodingType enc, const time_t last_modified)
void | set_mime_multipart (ostream &strm, const string &boundary, const string &start, ObjectType type, EncodingType enc, const time_t last_modified, const string &protocol, const string &url)
void | set_mime_ddx_boundary (ostream &strm, const string &boundary, const string &cid, ObjectType type, EncodingType enc)
void | set_mime_data_boundary (ostream &strm, const string &boundary, const string &cid, ObjectType type, EncodingType enc)
void | set_mime_error (FILE *out, int code, const string &reason, const string &version)
void | set_mime_error (ostream &strm, int code, const string &reason, const string &version)
void | set_mime_not_modified (FILE *out)
| Send a ‘Not Modified’ response.
void | set_mime_not_modified (ostream &strm)
| Send a ‘Not Modified’ response.
parse_error

Generate error messages for the various parsers.

`parser_error()` generates error messages for the various parsers used by libdap. There are two versions of the function, one which takes a `const char *message` and a `const int line_num` and writes the message and line number too stderr and a second which takes an additional `parser_arg arg` parameter and writes the error message into an Error object which is returned to the caller via the `arg` parameter.

Note
  {The second version of this function also accepts a third parameter (`const char *context`) which can be used to provide an additional line of information beyond what is in the string `message`.}

Returns
  void

void | parse_error (parser_arg *arg, const char *msg, const int line_num, const char *context)
void | parse_error (const string &msg, const int line_num, const char *context)
Integer to string conversion functions

Fast, safe conversions from long to a character representation which gets appended to a string. This method will take a long value 'val' and it will recursively divide it by 'base' in order to "extract" one by one the digits which compose it; these digits will be appended to the string `str_val` which will become the textual representation of 'val'. Please notice that the digits `‘extracted’' from ‘val’ will vary depending on the base chosen for the conversion; for example val=15 converted to base 10 will yield the digits (1,5), converted to base 16 will yield (F) and converted to base 2 will yield (1,1,1,1).

Parameters

  val | The long value we which to convert to string.
  base | A value in the range [2,36] which is the base to use while transforming the long value 'val' to its textual representation. Typical bases are 2 (binary), 10 (decimal) and 16 (hexadecimal).

  str_val

  This is the string that will hold the textual representation of 'val'. The string `str_val` should be pre-set to an empty string ("") otherwise the output of this function will just append the textual representation of val to whatever data is there; these feature may be useful if you wish to append a long value to a string s1 (just like operator+ does) without having to create a new string object s2 and then use string::operator+ between s1 and s2.

Returns
  void. This method returns nothing however be aware that it will throw and exception of type `std::invalid_argument` if the parameter base is not in the valid range.

void | append_long_to_string (long val, int base, string &str_val)
string | long_to_string (long val, int base)
Double to string conversion functions

Conversions from double to a character representation which gets appended to a string. This function depends on the standard routine sprintf to convert a double to a textual representation which gets appended to the string 'str'.

Parameters

  num | The double you wish to append to str.
  str | The string where the textual representation of num will be appended.

Returns
  void.

void | append_double_to_string (const double &num, string &str)
string | double_to_string (const double &num)
string | path_to_filename (string path)
int | glob (const char *c, const char *s)
time_t | parse_time (const char *str, bool expand)
Security functions
bool | size_ok (unsigned int sz, unsigned int nelem)
| sanitize the size of an array. Test for integer overflow when dynamically allocating an array.
bool | pathname_ok (const string &path, bool strict)

Does the string name a potentially valid pathname? Test the given pathname to verify that it is a valid name. We define this as: Contains only printable characters; and Is less then 256 characters. If strict is true, test that the pathname consists of only letters, digits, and underscore, dash and dot characters instead of the more general case where a pathname can be composed of any printable characters.

string | dap_version ()
string | open_temp_fstream (ofstream &f, const string &name_template, const string &suffix)

## Variables

const string | c_dap40_namespace = "http://xml.opendap.org/ns/DAP/4.0#"
int | dods_keep_temps = 0
const int | DODS_MAX_ARRAY = DODS_INT_MAX
const size_t | line_length = 1024
const unsigned int | max_str_len = DODS_USHRT_MAX - 1
const unsigned int | max_url_len = 255
const string | usage
int | www_trace = 0
int | www_trace_extensive = 0

## get information using an iterator

const string | double_quote = "\""

## Detailed Description

top level DAP object to house generic methods

Define this symbol iff we decide to include information about the byte order of the response (as sent from the server) so that the client can determine the correct CRC32 hash code. jhrg 1/4/16

## Typedef Documentation

## BaseTypeRow

typedef vector< BaseType * > libdap::BaseTypeRow

The type BaseTypeRow is used to store single rows of values in an instance of Sequence. Values are stored in instances of BaseType.

Definition at line 50 of file D4Sequence.h.

## byte_arg_list

typedef std::vector<dods_byte>* libdap::byte_arg_list

Definition at line 73 of file RValue.h.

## D4Function

typedef BaseType *(* libdap::D4Function) (D4RValueList *, DMR &)

Definition at line 42 of file D4Function.h.

## D4SeqRow

typedef vector<BaseType *> libdap::D4SeqRow

The type BaseTypeRow is used to store single rows of values in an instance of D4Sequence. Values are stored in instances of BaseType.

Definition at line 43 of file D4Sequence.h.

## D4SeqValues

typedef vector<D4SeqRow *> libdap::D4SeqValues

This type holds all of the values of a D4Sequence.

Definition at line 46 of file D4Sequence.h.

## dods_byte

typedef uint8_t libdap::dods_byte

Definition at line 21 of file dods-datatypes-static.h.

## dods_enum

typedef int64_t libdap::dods_enum

Definition at line 34 of file dods-datatypes-static.h.

## dods_float32

typedef float libdap::dods_float32

Definition at line 25 of file dods-datatypes-static.h.

## dods_float64

typedef double libdap::dods_float64

Definition at line 23 of file dods-datatypes-static.h.

## dods_int16

typedef int16_t libdap::dods_int16

Definition at line 17 of file dods-datatypes-static.h.

## dods_int32

typedef int32_t libdap::dods_int32

Definition at line 13 of file dods-datatypes-static.h.

## dods_int64

typedef int64_t libdap::dods_int64

Definition at line 30 of file dods-datatypes-static.h.

## dods_int8

typedef int8_t libdap::dods_int8

Definition at line 28 of file dods-datatypes-static.h.

## dods_uint16

typedef uint16_t libdap::dods_uint16

Definition at line 19 of file dods-datatypes-static.h.

## dods_uint32

typedef uint32_t libdap::dods_uint32

Definition at line 15 of file dods-datatypes-static.h.

## dods_uint64

typedef uint64_t libdap::dods_uint64

Definition at line 32 of file dods-datatypes-static.h.

## ErrorCode

typedef int libdap::ErrorCode

An enumerated type for common errors.

The most common errors within DAP2 have special codes so that they can be spotted easily by the client software. Any error without a matching code gets the `unknown_error` code.

Definition at line 58 of file Error.h.

## float32_arg_list

typedef std::vector<dods_float32>* libdap::float32_arg_list

Definition at line 78 of file RValue.h.

## float64_arg_list

typedef std::vector<dods_float64>* libdap::float64_arg_list

Definition at line 79 of file RValue.h.

## int16_arg_list

typedef std::vector<dods_int16>* libdap::int16_arg_list

Definition at line 74 of file RValue.h.

## int32_arg_list

typedef std::vector<dods_int32>* libdap::int32_arg_list

Definition at line 76 of file RValue.h.

## rvalue_list

typedef std::vector<rvalue *> libdap::rvalue_list

Definition at line 69 of file RValue.h.

## rvalue_list_citer

typedef std::vector<rvalue*>::const_iterator libdap::rvalue_list_citer

Definition at line 70 of file RValue.h.

## rvalue_list_iter

typedef std::vector<rvalue*>::iterator libdap::rvalue_list_iter

Definition at line 71 of file RValue.h.

## SequenceValues

typedef vector< BaseTypeRow * > libdap::SequenceValues

This type holds all of the values of a Sequence.

Definition at line 53 of file D4Sequence.h.

## Sigfunc

typedef void libdap::Sigfunc(int)

Definition at line 37 of file SignalHandler.h.

## uint16_arg_list

typedef std::vector<dods_uint16>* libdap::uint16_arg_list

Definition at line 75 of file RValue.h.

## uint32_arg_list

typedef std::vector<dods_uint32>* libdap::uint32_arg_list

Definition at line 77 of file RValue.h.

## Enumeration Type Documentation

## AttrType

enum libdap::AttrType

AttrType identifies the data types which may appear in an attribute table object.

enum AttrType {
Attr_unknown,
Attr_container,
Attr_byte,
Attr_int16,
Attr_uint16,
Attr_int32,
Attr_uint32,
Attr_float32,
Attr_float64,
Attr_string,
Attr_url,
Attr_other_xml
};
libdap::AttrType
AttrType
Definition AttrTable.h:81

See also
  AttrTable

Definition at line 81 of file AttrTable.h.

## CacheDisconnectedMode

enum libdap::CacheDisconnectedMode

Disconnected Operation

The cache can be set to handle disconnected operation where it does not use the network to validate entries and does not attempt to load new documents. All requests that cannot be fulfilled by the cache will be returned with a "504 Gateway Timeout" response. There are two operational disconnected modes:

No network activity at all: Here it uses its own persistent cache to answer the request, if possible.

Forward all disconnected requests to a proxy cache: Here it uses the HTTP/1.1 cache-control header to indicate that the proxy should operate in disconnected mode.

Definition at line 47 of file HTTPCacheDisconnectedMode.h.

## DAPVersion

enum libdap::DAPVersion

Definition at line 32 of file DapXmlNamespaces.h.

## EncodingType

enum libdap::EncodingType

The type of encoding used on the current stream.

libdap understands two types of encoding: x-plain and deflate, which correspond to plain uncompressed data and data compressed with zlib's LZW algorithm respectively.

`enum EncodingType { unknown_enc, deflate, x_plain, gzip, binary };`

Definition at line 48 of file EncodingType.h.

## ObjectType

enum libdap::ObjectType

The type of object in the stream coming from the data server.

When a version 2.x or greater DAP data server sends an object, it may use the Content-Description header of the response to indicate the type of object contained in the response.

     enum ObjectType {
       unknown_type,
       dods_das,
       dods_dds,
       dods_data,
       dods_ddx,
       dods_data_ddx,
       dods_error,
       web_error,

       dap4_dmr,
       dap4_data,
       dap4_error,
     };

Note
  If this is cjanged, update the char* array 'descrip' in mime_util.h.

Definition at line 58 of file ObjectType.h.

## Part

enum libdap::Part

Names the parts of multi-section constructor data types.

Part names the parts of multi-section constructor types. For example, the Grid class has an array and the array maps. Use the `nil` value for data types that don't have separate parts.

enum Part {
nil,
array,
maps
};
libdap::Part
Part
Names the parts of multi-section constructor data types.
Definition Type.h:48

See also
  Grid
  BaseType

Definition at line 48 of file Type.h.

## RejectReasonCode

enum libdap::RejectReasonCode

Definition at line 16 of file D4AsyncUtil.h.

## Type

enum libdap::Type

Identifies the data type.

Type identifies the data type stored in a particular type class. All the DODS Data Access Protocol (DAP) types inherit from the BaseType class.

enum Type {
dods_null_c,
dods_byte_c,
dods_int16_c,
dods_uint16_c,
dods_int32_c,
dods_uint32_c,
dods_float32_c,
dods_float64_c,
dods_str_c,
dods_url_c,
dods_structure_c,
dods_array_c,
dods_sequence_c,
dods_grid_c,
dods_char_c,
dods_int8_c,
dods_uint8_c,
dods_int64_c,
dods_uint64_c,
dods_enum_c,
dods_opaque_c,
dods_group_c
};
libdap::Type
Type
Identifies the data type.
Definition Type.h:94

See also
  BaseType

Definition at line 94 of file Type.h.

## Function Documentation

## add_space_encoding()

string libdap::add_space_encoding | ( | const string & | s | ) |

Add %20 space encoding.

Definition at line 78 of file AttrTable.cc.

## append_double_to_string()

void libdap::append_double_to_string | ( | const double & | num,
|  | string & | str
| ) |  |

Definition at line 970 of file util.cc.

## append_long_to_string()

void libdap::append_long_to_string | ( | long | val,
|  | int | base,
|  | string & | str_val
| ) |  |

Definition at line 936 of file util.cc.

## append_rvalue_list()

rvalue_list * libdap::append_rvalue_list | ( | rvalue_list * | rvals,
|  | rvalue * | rv
| ) |  |

Definition at line 69 of file RValue.cc.

## AttrType_to_String()

string libdap::AttrType_to_String | ( | const AttrType | at | ) |

Convert an AttrType to it's string representation.

Parameters

  at | The Attribute Type.

Returns
  The type's string representation

Definition at line 97 of file AttrTable.cc.

## build_btp_args()

BaseType ** libdap::build_btp_args | ( | const rvalue_list * | args,
|  | DDS & | dds
| ) |  |

Build an argument list suitable for calling a `btp_func`, `bool_func`, and so on. Since this takes an rvalue_list and not an rvalue, it is a function rather than a class member.

This function performs a common task but does not fit within the RValue class well. It is used by Clause and ce_expr.y.

Parameters

  args | A list of RValue objects
  dds | Use this DDS when evaluating functions

Definition at line 88 of file RValue.cc.

## cid_to_header_value()

std::string libdap::cid_to_header_value | ( | const string & | cid | ) |

Given a Content-Id read from the DDX, return the value to look for in a MPM Content-Id header. This function downcases the CID to match the value returned by parse_mime_header.

Parameters

  cid | The Content-Id read from the DDX

Returns
  The header value to look for.

Exceptions

  Error | if the CID does not start with the string "cid:"

Definition at line 1075 of file mime_util.cc.

## close_temp()

void libdap::close_temp | ( | FILE * | s,
|  | const string & | name
| ) |  |

close temporary files - used here and in ~HTTPResponse

Parameters

  s |
  name |

Definition at line 827 of file HTTPConnect.cc.

## Cmp()

template<class T1 , class T2 >

bool libdap::Cmp | ( | int | op,
|  | T1 | v1,
|  | T2 | v2
| ) |  |

Compare two numerical types, both of which are either signed or unsigned. This class is one implementation of the comparison policy used by rops.

See also
  rops
  USCmp
  SUCmp

Definition at line 53 of file Operators.h.

## D2type_name()

string libdap::D2type_name | ( | Type | t | ) |

Returns the type of the class instance as a string. Supports all DAP2 types and not the DAP4-only types. Also returns Url (DAP2) and not "URL" (DAP4) for the URL type.

Parameters

  t | The type code

Returns
  The type name in a string

Definition at line 652 of file util.cc.

## D4AttributeTypeToString()

string libdap::D4AttributeTypeToString | ( | D4AttributeType | at | ) |

Convert an AttrType to it's string representation.

Parameters

  at | The Attribute Type.

Returns
  The type's string representation

Definition at line 45 of file D4Attributes.cc.

## D4RValueFactory()

D4RValue * libdap::D4RValueFactory | ( | std::string | cpps | ) |

Build an appropriate RValue.

Look at the value in the string parameter and build an appropriate BaseType, use that as a constant and build an RValue. This can be used by the DAP4 parser directly to build the constants in filter clauses.

Parameters

  cpps | The string argument read by the parser.

Returns
  A D4RValue pointer.

Definition at line 218 of file D4RValue.cc.

## D4type_name()

string libdap::D4type_name | ( | Type | t | ) |

Returns the type of the class instance as a string. Supports all DAP4 types and not the DAP2-only types. Also returns URL (DAP4) and not "Url" (DAP2) for the URL type.

Parameters

  t | The type code

Returns
  The type name in a string

Definition at line 697 of file util.cc.

## dap_version()

string libdap::dap_version | ( |  | ) |

Get the version of the DAP library.

Deprecated:

Definition at line 1215 of file util.cc.

## date_time_str()

std::string libdap::date_time_str | ( | time_t * | calendar,
|  | bool | local
| ) |  |

Given a time in seconds since midnight 1 Jan 1970, return the RFC 1123 date string. Example result string: Sun, 06 Nov 1994 08:49:37 GMT

Parameters

  calendar | Time in seconds
  local | If true, return the local time, if false return GMT. The default value is false.

Returns
  A RFC 1123 date string.

Definition at line 273 of file util_mit.cc.

## dir_exists()

bool libdap::dir_exists | ( | const string & | dir | ) |

Does the directory exist?

Parameters

  dir | The pathname to test.

Returns
  True if the directory exists, false otherwise

Definition at line 928 of file util.cc.

## do_version()

bool libdap::do_version | ( | const string & | script_ver,
|  | const string & | dataset_ver
| ) |  |

Send a version number.

This sends a formatted block of text to the client, containing version information about various aspects of the server. The arguments allow you to enclose version information about the filter program and the dataset in the message. Either argument (or both) may be omitted, in which case no script or dataset version information will be printed.

Parameters

  script_ver | The version of the filter script executing this function.
  dataset_ver | The version of the dataset.

Returns
  TRUE for success. Always returns true.

Definition at line 190 of file mime_util.cc.

## double_eq()

bool libdap::double_eq | ( | double | lhs,
|  | double | rhs,
|  | double | epsilon = `1.0e-5`
| ) |  |

inline

Is lhs equal to rhs? Use epsilon to determine equality.

Definition at line 55 of file util.h.

## double_to_string()

string libdap::double_to_string | ( | const double & | num | ) |

Definition at line 980 of file util.cc.

## downcase()

void libdap::downcase | ( | string & | s | ) |

Downcase the source string. This function modifies its argument.

Parameters

  The | string to modify

Definition at line 566 of file util.cc.

## ErrMsgT()

void libdap::ErrMsgT | ( | const string & | Msgt | ) |

Logs an error message.

Prints an error message in the `httpd` system log file, along with a time stamp and the client host name (or address).

Use this instead of the functions in liberrmsg.a in the programs run by the CGIs to report errors so those errors show up in HTTPD's log files.

Deprecated:

Returns
  void

Definition at line 223 of file mime_util.cc.

## esc2underscore()

string libdap::esc2underscore | ( | string | s | ) |

Return a string that has all the `%<hex` digit><hex digit> sequences replaced with underscores (‘_’).

Parameters

  s | The string to transform

Returns
  The modified string.

Definition at line 354 of file escaping.cc.

## escape_double_quotes()

string libdap::escape_double_quotes | ( | string | source | ) |

Rip through a string and replace all the double quotes with " sequences.

Parameters

  source |

Returns
  result

Definition at line 499 of file escaping.cc.

## escattr()

string libdap::escattr | ( | string | s | ) |

Escape non-printable characters and quotes from an HDF attribute.

Parameters

  s | The attribute to modify.

Returns
  The modified attribute.

Definition at line 368 of file escaping.cc.

## escattr_xml()

string libdap::escattr_xml | ( | string | s | ) |

Escape non-printable characters and quotes from an HDF attribute.

Parameters

  s | The attribute to modify.

Returns
  The modified attribute.

Definition at line 402 of file escaping.cc.

## extract_double_array() [1/2]

double * libdap::extract_double_array | ( | Array * | a | ) |

Given a pointer to an Array which holds a numeric type, extract the values and return in an array of doubles. This function allocates the array using 'new double[n]' so delete[] MUST be used when you are done the data.

Note
  Support added for DAP4.

Parameters

  a | Extract value from this Array.

Returns
  A C++/C array of doubles.

Definition at line 261 of file util.cc.

## extract_double_array() [2/2]

void libdap::extract_double_array | ( | Array * | a,
|  | vector< double > & | dest
| ) |  |

Given a pointer to an Array which holds a numeric type, extract the values and return in an array of doubles. This function allocates the array using 'new double[n]' so delete[] MUST be used when you are done the data.

Note
  Before you call this function, you must call read on the array, or load the array with values and set the read_p property.
  Support added for DAP4.

Parameters

  a | Extract value from this Array.
  dest | Put the values in this vector. A value-result parameter.

Returns
  A C++/C array of doubles.

Definition at line 343 of file util.cc.

## extract_double_value()

double libdap::extract_double_value | ( | BaseType * | arg | ) |

Given a BaseType pointer, extract the numeric value it contains and return it in a C++ double.

Note
  Support for DAP4 types added.

Parameters

  arg | The BaseType pointer

Returns
  A C++ double

Exceptions

  Error | thrown if the referenced BaseType object does not contain a DAP numeric value.

Definition at line 402 of file util.cc.

## extract_string_argument()

string libdap::extract_string_argument | ( | BaseType * | arg | ) |

Given a BaseType pointer, extract the string value it contains

Parameters

  arg | The BaseType pointer

Returns
  A C++ string

Exceptions

  Error | thrown if the referenced BaseType object does not contain a DAP String.

Definition at line 119 of file util.cc.

## fillConstructorAttrTable()

void libdap::fillConstructorAttrTable | ( | AttrTable * | at,
|  | BaseType * | bt
| ) |  |

Recursive helper function for Building DAS entries for Constructor types.

Parameters

  at | Add Constructor content to this Attribute table
  bt | A pointer to a BaseType which may be an instance of Constructor.

Definition at line 1127 of file DDS.cc.

## get_dap2_AttrType()

AttrType libdap::get_dap2_AttrType | ( | D4AttributeType | d4_type | ) |

Definition at line 280 of file D4Attributes.cc.

## get_description_type()

ObjectType libdap::get_description_type | ( | const string & | value | ) |

This function returns the ObjectType value that matches the given string. Modified to include tests for the descriptions that use hyphens in addition to underscores. 8/1/08 jhrg

Parameters

  value | Value from the HTTP response header

Definition at line 337 of file mime_util.cc.

## get_dims_decl()

string libdap::get_dims_decl | ( | Array & | a | ) |

Makes the square bracket representation, with dimension names where available, of the array's dimensions, ex: [5][lat=100][lon=200]

Parameters

  a | The array to examine

Returns
  The square bracket representation of the array's dimensions

Definition at line 1448 of file Array.cc.

## get_hash()

int libdap::get_hash | ( | const string & | url | ) |

Compute the hash value for a URL.

Parameters

  url |

Returns
  An integer hash code between 0 and CACHE_TABLE_SIZE.

Definition at line 98 of file HTTPCacheTable.cc.

## get_next_mime_header() [1/2]

std::string libdap::get_next_mime_header | ( | FILE * | in | ) |

Read the next MIME header from the input stream and return it in a string object. This function consumes any leading whitespace before the next header. It returns an empty string when the blank line that separates the headers from the body is found. This function works for header and separator lines that use either a CRLF pair (the correct line ending) or just a newline (a common error).

Deprecated:

Note
  FIXME: This function returns tainted data.

Parameters

  in | Read from this stream (FILE *)

Returns
  A string that contains the next header line or is empty indicating the separator has been read.

Exceptions

  Error | is thrown if no header or separator is found.

See also
  parse_mime_header()

Definition at line 836 of file mime_util.cc.

## get_next_mime_header() [2/2]

std::string libdap::get_next_mime_header | ( | istream & | in | ) |

This function and its companion read the next MIME header from an input stream (or FILE*) and return it as a string. The stream pointer is updated to the next line of input. It returns an empty string when the blank line ending the MIME headers is found.

Note
  FIXME: This function returns tainted data.

Parameters

  in | Read the next header from the input stream

Returns
  Return the next header in a string; an empty string indicates all headers have been returned.

Definition at line 869 of file mime_util.cc.

## get_temp_file()

string libdap::get_temp_file | ( | FILE *& | stream | ) |
throw | ( | Error
| ) |  |

Open a temporary file and return its name. This method opens a temporary file using get_tempfile_template(). The FILE* `stream` is opened for both reads and writes; if it already exists (highly unlikely), it is truncated. If used on Unix, it's the callers responsibility to unlink the named file so that when all descriptors to it are closed, it will be deleted. On Win32 platforms, this method pushes the name of the temporary file onto a vector which is used during object destruction to delete all the temporary files.

Note
  Delete the returned char* using delete[].

A private method.

Parameters

  stream | A value-result parameter; the open file descriptor is returned via this parameter.

Returns
  The name of the temporary file.

Exceptions

  InternalErr | thrown if the FILE* could not be opened.

Definition at line 787 of file HTTPConnect.cc.

## get_type() [1/2]

Type libdap::get_type | ( | const char * | name | ) |

Get the Type enumeration value which matches the given name.

Definition at line 597 of file util.cc.

## get_type() [2/2]

ObjectType libdap::get_type | ( | const string & | value | ) |

This function returns the ObjectType value that matches the given string. Modified to include tests for the descriptions that use hyphens in addition to underscores. 8/1/08 jhrg

Deprecated:

Definition at line 324 of file mime_util.cc.

## glob()

int libdap::glob | ( | const char * | c,
|  | const char * | s
| ) |  |

glob: match a string against a simple pattern

Understands the following patterns:

- any number of characters ? any single character [a-z] any single character in the range a-z [^a-z] any single character not in the range a-z \x match x

Parameters

  c | The pattern
  s | The string

Returns
  0 on success, -1 if the pattern is exhausted but there are characters remaining in the string and 1 if the pattern does not match

Definition at line 1072 of file util.cc.

## has_dap2_attributes() [1/2]

bool libdap::has_dap2_attributes | ( | AttrTable & | a | ) |

Does this AttrTable have descendants that are scalar or vector attributes?

Parameters

  a | The AttrTable

Returns
  true if the table contains a scalar- or vector-valued attribute, otherwise false.

Definition at line 955 of file DDS.cc.

## has_dap2_attributes() [2/2]

bool libdap::has_dap2_attributes | ( | BaseType * | btp | ) |

Does this variable, or any of its descendants, have attributes?

Parameters

  btp | The variable

Returns
  True if any of the variable's descendants have attributes, otherwise false.

Definition at line 977 of file DDS.cc.

## hexstring()

string libdap::hexstring | ( | unsigned char | val | ) |

Definition at line 82 of file escaping.cc.

## id2www()

string libdap::id2www | ( | string | in,
|  | const string & | allowable
| ) |  |

Replace characters that are not allowed in DAP2 identifiers.

-In the DAP itself, id2www() is called in:

1. Array::print_decl() where dimension names are escaped
2. AttrTable::print() (which calls AttrTable::simple_print()) where attribute names are escaped
3. BaseType::print_decl() where variable names are escaped.
4. Constructor::print_decl() where the name of the constructor type is printed.
5. DDS::print() and DDS::print_constrained() where the name of the dataset is printed.
6. Grid::print_decl() where the name of the grid is printed.

-In the client code:

1. id2www_ce() is called five times in the five methods that are used to request responses where a CE is appended to a URL (Connect::request_version, request_protocol, request_das, request_dds, request_data).

Parameters

  in | Replace characters in this string.
  allowable | The set of characters that are allowed in a URI. default: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+_/.\\*"

See also
  id2www_ce()

Returns
  The modified identifier.

Definition at line 153 of file escaping.cc.

## id2www_ce()

string libdap::id2www_ce | ( | string | in,
|  | const string & | allowable
| ) |  |

Replace characters that are not allowed in WWW URLs using rules specific to Constraint Expressions. This has changed over time and now the only difference is that '*' is escaped by this function while it is not escaped by id2www().

Parameters

  in | The string in which to replace characters.
  allowable | The set of characters that are allowed in a URI. default: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+_/.\\"

See also
  id2www()

Returns
  The modified identifier.

Definition at line 178 of file escaping.cc.

## id2xml()

string libdap::id2xml | ( | string | in,
|  | const string & | not_allowed
| ) |  |

Replace characters that are not allowed in XML

Parameters

  in | The string in which to replace characters.
  not_allowed | The set of characters that are not allowed in XML. default: ><&'(single quote)"(double quote)

Returns
  The modified identifier.

Definition at line 272 of file escaping.cc.

## is_boundary()

bool libdap::is_boundary | ( | const char * | line,
|  | const string & | boundary
| ) |  |

Is this string the same as the MPM boundary value?

Note
  Since fgets() is used to read into line, it is guaranteed to be null terminated.

Parameters

  line | The input to test
  boundary | The complete boundary line to test for, excluding terminating characters.

Returns
  true is line is a MPM boundary

Definition at line 939 of file mime_util.cc.

## is_constructor_type()

bool libdap::is_constructor_type | ( | Type | t | ) |

Returns true if the instance is a constructor (i.e., Structure, Sequence or Grid) type variable.

Returns
  True if the instance is a Structure, Sequence or Grid, False otherwise.

Definition at line 862 of file util.cc.

## is_hop_by_hop_header()

bool libdap::is_hop_by_hop_header | ( | const string & | header | ) |

Is the header a hop by hop header? If so, we're not supposed to store it in the cache. See RFC 2616, Section 13.5.1.

Returns
  True if the header is, otherwise False.

Definition at line 954 of file HTTPCache.cc.

## is_host_big_endian()

bool libdap::is_host_big_endian | ( |  | ) |

Does this host use big-endian byte order?

Definition at line 94 of file util.cc.

## is_integer_type()

bool libdap::is_integer_type | ( | Type | t | ) |

Is this an integer type?

Returns
  True if the type holds an integer value, false otherwise.

Definition at line 903 of file util.cc.

## is_keyword()

bool libdap::is_keyword | ( | string | id,
|  | const string & | keyword
| ) |  |

Definition at line 176 of file parser-util.cc.

## is_quoted()

bool libdap::is_quoted | ( | const string & | s | ) |

Is the string surrounded by double quotes?

Parameters

  s | The source string @reurn True if the string is quoted, false otherwise.

Definition at line 577 of file util.cc.

## is_simple_type()

bool libdap::is_simple_type | ( | Type | t | ) |

Returns true if the instance is a numeric, string or URL type variable.

Returns
  True if the instance is a scalar numeric, String or URL variable, False otherwise. Arrays (even of simple types) return False.

See also
  is_vector_type()

Definition at line 778 of file util.cc.

## is_vector_type()

bool libdap::is_vector_type | ( | Type | t | ) |

Returns true if the instance is a vector (i.e., array) type variable.

Returns
  True if the instance is an Array, False otherwise.

Definition at line 818 of file util.cc.

## last_modified_time()

time_t libdap::last_modified_time | ( | const string & | name | ) |

Get the last modified time. Assume `name` is a file and find its last modified time. If `name` is not a file, then return now as the last modified time.

Parameters

  name | The name of a file.

Returns
  The last modified time or the current time.

Definition at line 95 of file mime_util.cc.

## libdap_name()

const char * libdap::libdap_name | ( |  | ) |

Definition at line 534 of file util.cc.

## libdap_root()

const char * libdap::libdap_root | ( |  | ) |

Definition at line 516 of file util.cc.

## libdap_version()

const char * libdap::libdap_version | ( |  | ) |

Return the version string for this package.

Note
  This function has C linkage so that it can be found using autoconf tests.

Returns
  The version string.

Definition at line 526 of file util.cc.

## long_to_string()

string libdap::long_to_string | ( | long | val,
|  | int | base
| ) |  |

Definition at line 962 of file util.cc.

## make_rvalue_list()

rvalue_list * libdap::make_rvalue_list | ( | rvalue * | rv | ) |

Definition at line 54 of file RValue.cc.

## munge_error_message()

string libdap::munge_error_message | ( | string | msg | ) |

Definition at line 477 of file escaping.cc.

## name_path()

std::string libdap::name_path | ( | const string & | path | ) |

Returns the filename portion of a pathname.

Given a pathname, this function returns just the file name component of the path. That is, given `/a/b/c/ralph.nc.das`, it returns `ralph.nc`.

Parameters

  path | A C-style simple string containing a pathname to be parsed.

Returns
  A C-style simple string containing the filename component of the given pathname.

Definition at line 266 of file mime_util.cc.

## octal_to_hex()

string libdap::octal_to_hex | ( | const string & | octal_digits | ) |

Definition at line 253 of file escaping.cc.

## octstring()

string libdap::octstring | ( | unsigned char | val | ) |

Definition at line 103 of file escaping.cc.

## open_temp_fstream()

string libdap::open_temp_fstream | ( | ofstream & | f,
|  | const string & | name_template,
|  | const string & | suffix
| ) |  |

Using the given template, open a temporary file using the given ofstream object. Uses mkstemp() in a 'safe' way.

Parameters

  f | Value-result parameter
  name_template | The template used to name the temporary file. The template has the form templateXXXXXX where the six Xs will be overwritten.
  suffix | If present, the template is 'templateXXXXXX.suffix'

Returns
  The new file's name.

Exceptions

  Error | if there is a problem.

Definition at line 1232 of file util.cc.

## parse_error() [1/3]

void libdap::parse_error | ( | const char * | msg,
|  | const int | line_num,
|  | const char * | context
| ) |  |

Definition at line 122 of file parser-util.cc.

## parse_error() [2/3]

void libdap::parse_error | ( | const string & | msg,
|  | const int | line_num,
|  | const char * | context
| ) |  |

Definition at line 151 of file parser-util.cc.

## parse_error() [3/3]

void libdap::parse_error | ( | parser_arg * | arg,
|  | const char * | msg,
|  | const int | line_num,
|  | const char * | context
| ) |  |

Definition at line 91 of file parser-util.cc.

## parse_mime_header()

void libdap::parse_mime_header | ( | const string & | header,
|  | string & | name,
|  | string & | value
| ) |  |

Given a string that contains a MIME header line, parse it into the the header (name) and its value. Both are downcased.

Parameters

  header | The input line, striped of the ending crlf pair
  name | A value-result parameter that holds the header name
  value | A value-result parameter that holds the header's value.

Definition at line 910 of file mime_util.cc.

## parse_time()

time_t libdap::parse_time | ( | const char * | str,
|  | bool | expand
| ) |  |

Parse a string in GMT format to a local time time_t representation Four formats are accepted: Wkd, 00 Mon 0000 00:00:00 GMT (rfc1123) Weekday, 00-Mon-00 00:00:00 GMT (rfc850) Wkd Mon 00 00:00:00 0000 GMT (ctime) 1*DIGIT (delta-seconds)

Copied from libwww. 09/19/02 jhrg

Parameters

  str | The time string.
  expand | If the time is given in delta seconds, adjust it to seconds since midnight 1 Jan 1970 if this is true. If false, simply convert the string to a time_t and return. The default value is true.

Returns
  The time in seconds since midnight 1 Jan 1970. Return 0 if an error is detected.

Definition at line 153 of file util_mit.cc.

## path_to_filename()

string libdap::path_to_filename | ( | string | path | ) |

Get the filename part from a path. This function can be used to return a string that has the directory components stripped from a path. This is useful when building error message strings.

If WIN32 is defined, use '\' as the path separator, otherwise use '/' as the path separator.

Returns
  A string containing only the filename given a path.

Definition at line 1009 of file util.cc.

## pathname_ok()

bool libdap::pathname_ok | ( | const string & | path,
|  | bool | strict
| ) |  |

Does the string name a potentially valid pathname? Test the given pathname to verify that it is a valid name. We define this as: Contains only printable characters; and Is less then 256 characters. If strict is true, test that the pathname consists of only letters, digits, and underscore, dash and dot characters instead of the more general case where a pathname can be composed of any printable characters.

Note
  Using this function does not guarantee that the path is valid, only that the path could be valid. The intent is foil attacks where an exploit is encoded in a string then passed to a library function. This code does not address whether the pathname references a valid resource.

Parameters

  path | The pathname to test
  strict | Apply more restrictive tests (true by default)

Returns
  true if the pathname consists of legal characters and is of legal size, false otherwise.

Definition at line 1173 of file util.cc.

## print_var_das()

void libdap::print_var_das | ( | ostream & | out,
|  | BaseType * | bt,
|  | string | indent = `""`
| ) |  |

Definition at line 1008 of file DDS.cc.

## prune_spaces()

string libdap::prune_spaces | ( | const string & | name | ) |

Removed spaces from the front of a URL and also from the front of the CE. This function assumes that there are no holes in both the URL and the CE. It will remove leading space, but not other spaces.

Parameters

  name | The URL to process

Returns
  Returns a new string object that contains the pruned URL.

Definition at line 459 of file util.cc.

## read_multipart_boundary() [1/2]

std::string libdap::read_multipart_boundary | ( | FILE * | in,
|  | const string & | boundary
| ) |  |

Read the next line of input and test to see if it is a multipart MIME boundary line. If the value of boundary is the default (an empty string) then just test that the line starts with "--". In either case, return the value of boundary just read.

Parameters

  boundary | Value of the boundary to look for - optional
  in | Read from this FILE*

Returns
  The value of the boundary header read

Exceptions

  Error | if no boundary was found.

Definition at line 957 of file mime_util.cc.

## read_multipart_boundary() [2/2]

std::string libdap::read_multipart_boundary | ( | istream & | in,
|  | const string & | boundary
| ) |  |

Definition at line 970 of file mime_util.cc.

## read_multipart_headers() [1/2]

void libdap::read_multipart_headers | ( | FILE * | in,
|  | const string & | content_type,
|  | const ObjectType | object_type,
|  | const string & | cid
| ) |  |

Consume the Multipart MIME headers that prefix the DDX in a DataDDX response. The stream pointer is advanced to the start of the DDX. It might seem odd that this function both takes the value of the MPM boundary as a parameter and returns that value as a result, but this code can be used in two different situations. In one case, it is called on a partial document read from stdin and needs to return the value of boundary to the downstream DDX parser so that code can sense the end of the DDX. In the other case, this function is told the value of boundary and tests for it to ensure document correctness.

Parameters

  in | Read from this stream
  content_type | The expected value of the Content-Type header
  object_type | The expected value of the Content-Description header
  cid | The expected value of the Content-Id header - optional.

Returns
  The value of the MIME boundary

Exceptions

  Error | if the boundary is not found or if any of the expected header values don't match. The optional values are tested only if they are given (the default values are not tested).

Definition at line 1003 of file mime_util.cc.

## read_multipart_headers() [2/2]

void libdap::read_multipart_headers | ( | istream & | in,
|  | const string & | content_type,
|  | const ObjectType | object_type,
|  | const string & | cid
| ) |  |

Definition at line 1036 of file mime_util.cc.

## remove_mime_header() [1/2]

bool libdap::remove_mime_header | ( | FILE * | in | ) |

Read and discard the MIME header of the stream `in`.

Read the input stream `in` and discard the MIME header. The MIME header is separated from the body of the document by a single blank line. If no MIME header is found, then the input stream is ‘emptied’ and will contain nothing.

Deprecated:

Returns
  True if a MIME header is found, false otherwise.

Definition at line 1210 of file mime_util.cc.

## remove_mime_header() [2/2]

void libdap::remove_mime_header | ( | istream & | in | ) |

Used for test code; strip the leading MIME headers from a response.

Parameters

  in |

Definition at line 1227 of file mime_util.cc.

## remove_quotes()

string libdap::remove_quotes | ( | const string & | s | ) |

Return a new string that is not quoted. This will return a new string regardless of whether the source string is actualy quoted.

Parameters

  s | The source string

Returns
  A new string without quotes

Definition at line 588 of file util.cc.

## remove_space_encoding()

string libdap::remove_space_encoding | ( | const string & | s | ) |

Remove %20 space encoding

Definition at line 61 of file AttrTable.cc.

## rfc822_date()

std::string libdap::rfc822_date | ( | const time_t | t | ) |

Given a constant pointer to a `time_t`, return a RFC 822/1123 style date.

This function returns the RFC 822 date with the exception that the RFC 1123 modification for four-digit years is implemented.

Returns
  The RFC 822/1123 style date in a C++ string.

Parameters

  t | A const `time_t` pointer.

Definition at line 156 of file mime_util.cc.

## save_str()

void libdap::save_str | ( | std::string & | dst,
|  | const char * | src,
|  | const int |
| ) |  |

Save a string to a temporary variable during the parse.

Given a string (`const char *src`), save it to the temporary variable pointed to by `dst`. If the string is longer than `ID_MAX`, generate and error indicating that `src` was truncated to `ID_MAX` characters during the copy operation. There are two versions of this function; one calls the version of `parser_error()` which writes to stderr. The version which accepts the `parser_arg *arg` argument calls the version of `parser_error()` which generates and Error object.

Returns
  void

Definition at line 171 of file parser-util.cc.

## set_array_using_double()

void libdap::set_array_using_double | ( | Array * | dest,
|  | double * | src,
|  | int | src_len
| ) |  |

Given an array that holds some sort of numeric data, load it with values using an array of doubles. This function makes several assumptions. First, it assumes the caller really wants to put the doubles into whatever types the array holds! Caveat emptor. Second, it assumes that if the size of source (src) array is different than the destination (dest) the caller has made a mistake. In that case it will throw an Error object.

After setting the values, this method sets the `read_p` property for dest. Setting read_p tells the serialization methods in libdap that this variable already holds data values and, given that, the serialization code will not try to read the values.

Note
  Support for DAP4 added.

Parameters

  dest | An Array. The values are written to this array, reusing its storage. Existing values are lost.
  src | The source data.
  src_len | The number of elements in the src array.

Exceptions

  Error | Thrown if dest is not a numeric-type array (Byte, ..., Float64) or if the number of elements in src does not match the number is dest.

Definition at line 166 of file util.cc.

## set_mime_binary() [1/3]

void libdap::set_mime_binary | ( | FILE * | out,
|  | ObjectType | type,
|  | const string & | ver,
|  | EncodingType | enc,
|  | const time_t | last_modified
| ) |  |

Write an HTTP 1.0 response header for our binary response document (i.e., the DataDDS object).

Deprecated:

Parameters

  out | Write the MIME header to this FILE pointer.
  type | The type of this this response. Defaults to application/octet-stream.
  ver | The version string; denotes the libdap implementation version.
  enc | How is this response encoded? Can be plain or deflate or the x_... versions of those. Default is x_plain.
  last_modified | The time to use for the Last-Modified header value. Default is zero which means use the current time.

Definition at line 621 of file mime_util.cc.

## set_mime_binary() [2/3]

void libdap::set_mime_binary | ( | ostream & | strm,
|  | ObjectType | type,
|  | const string & | ver,
|  | EncodingType | enc,
|  | const time_t | last_modified
| ) |  |

Write an HTTP 1.0 response header for our binary response document (i.e., the DataDDS object).

Deprecated:

Parameters

  strm | Write the MIME header to this stream.
  type | The type of this this response. Defaults to application/octet-stream.
  ver | The version string; denotes the libdap implementation version.
  enc | How is this response encoded? Can be plain or deflate or the x_... versions of those. Default is x_plain.
  last_modified | The time to use for the Last-Modified header value. Default is zero which means use the current time.

Definition at line 644 of file mime_util.cc.

## set_mime_binary() [3/3]

void libdap::set_mime_binary | ( | ostream & | strm,
|  | ObjectType | type,
|  | EncodingType | enc,
|  | const time_t | last_modified,
|  | const string & | protocol
| ) |  |

Write an HTTP 1.0 response header for our binary response document (i.e., the DataDDS object).

Parameters

  strm | Write the MIME header to this stream.
  type | The type of this this response. Defaults to application/octet-stream.
  ver | The version string; denotes the libdap implementation version.
  enc | How is this response encoded? Can be plain or deflate or the x_... versions of those. Default is x_plain.
  last_modified | The time to use for the Last-Modified header value. Default is zero which means use the current time.

Definition at line 688 of file mime_util.cc.

## set_mime_data_boundary()

void libdap::set_mime_data_boundary | ( | ostream & | strm,
|  | const string & | boundary,
|  | const string & | cid,
|  | ObjectType | type,
|  | EncodingType | enc
| ) |  |

Definition at line 806 of file mime_util.cc.

## set_mime_ddx_boundary()

void libdap::set_mime_ddx_boundary | ( | ostream & | strm,
|  | const string & | boundary,
|  | const string & | cid,
|  | ObjectType | type,
|  | EncodingType | enc
| ) |  |

Definition at line 792 of file mime_util.cc.

## set_mime_error() [1/2]

void libdap::set_mime_error | ( | FILE * | out,
|  | int | code,
|  | const string & | reason,
|  | const string & | version
| ) |  |

Generate an HTTP 1.0 response header for an Error object.

Deprecated:

Parameters

  out | Write the MIME header to this FILE pointer.
  code | HTTP 1.0 response code. Should be 400, ... 500, ...
  reason | Reason string of the HTTP 1.0 response header.
  version | The version string; denotes the DAP spec and implementation version.

Definition at line 1098 of file mime_util.cc.

## set_mime_error() [2/2]

void libdap::set_mime_error | ( | ostream & | strm,
|  | int | code,
|  | const string & | reason,
|  | const string & | version
| ) |  |

Generate an HTTP 1.0 response header for an Error object.

Deprecated:

Parameters

  strm | Write the MIME header to this stream.
  code | HTTP 1.0 response code. Should be 400, ... 500, ...
  reason | Reason string of the HTTP 1.0 response header.
  version | The version string; denotes the DAP spec and implementation version.

Definition at line 1115 of file mime_util.cc.

## set_mime_html() [1/3]

void libdap::set_mime_html | ( | FILE * | out,
|  | ObjectType | type,
|  | const string & | ver,
|  | EncodingType | enc,
|  | const time_t | last_modified
| ) |  |

Generate an HTTP 1.0 response header for a html document.

Deprecated:

Parameters

  out | Write the MIME header to this FILE pointer.
  type | The type of this this response.
  ver | The version string; denotes the libdap implementation version.
  enc | How is this response encoded? Can be plain or deflate or the x_... versions of those. Default is x_plain.
  last_modified | The time to use for the Last-Modified header value. Default is zero which means use the current time.

Definition at line 507 of file mime_util.cc.

## set_mime_html() [2/3]

void libdap::set_mime_html | ( | ostream & | strm,
|  | ObjectType | type,
|  | const string & | ver,
|  | EncodingType | enc,
|  | const time_t | last_modified
| ) |  |

Generate an HTTP 1.0 response header for a html document.

Deprecated:

Parameters

  strm | Write the MIME header to this stream.
  type | The type of this this response.
  ver | The version string; denotes the libdap implementation version.
  enc | How is this response encoded? Can be plain or deflate or the x_... versions of those. Default is x_plain.
  last_modified | The time to use for the Last-Modified header value. Default is zero which means use the current time.

Definition at line 527 of file mime_util.cc.

## set_mime_html() [3/3]

void libdap::set_mime_html | ( | ostream & | strm,
|  | ObjectType | type,
|  | EncodingType | enc,
|  | const time_t | last_modified,
|  | const string & | protocol
| ) |  |

Generate an HTTP 1.0 response header for a html document.

Parameters

  strm | Write the MIME header to this stream.
  type | The type of this this response.
  ver | The version string; denotes the libdap implementation version.
  enc | How is this response encoded? Can be plain or deflate or the x_... versions of those. Default is x_plain.
  last_modified | The time to use for the Last-Modified header value. Default is zero which means use the current time.

Definition at line 572 of file mime_util.cc.

## set_mime_multipart() [1/2]

void libdap::set_mime_multipart | ( | ostream & | strm,
|  | const string & | boundary,
|  | const string & | start,
|  | ObjectType | type,
|  | const string & | version,
|  | EncodingType | enc,
|  | const time_t | last_modified
| ) |  |

Definition at line 718 of file mime_util.cc.

## set_mime_multipart() [2/2]

void libdap::set_mime_multipart | ( | ostream & | strm,
|  | const string & | boundary,
|  | const string & | start,
|  | ObjectType | type,
|  | EncodingType | enc,
|  | const time_t | last_modified,
|  | const string & | protocol,
|  | const string & | url
| ) |  |

Build the initial headers for the DAP4 data response

Definition at line 754 of file mime_util.cc.

## set_mime_not_modified() [1/2]

void libdap::set_mime_not_modified | ( | FILE * | out | ) |

Send a ‘Not Modified’ response.

Use this function to create a response signaling that the target of a conditional get has not been modified relative to the condition given in the request. This will have to be a date until the servers support ETags.

Deprecated:

Parameters

  out | Write the response to this FILE pointer.

Definition at line 1143 of file mime_util.cc.

## set_mime_not_modified() [2/2]

void libdap::set_mime_not_modified | ( | ostream & | strm | ) |

Send a ‘Not Modified’ response.

Use this function to create a response signaling that the target of a conditional get has not been modified relative to the condition given in the request. This will have to be a date until the servers support ETags.

Deprecated:

Parameters

  strm | Write the response to this stream.

Definition at line 1158 of file mime_util.cc.

## set_mime_text() [1/3]

void libdap::set_mime_text | ( | FILE * | out,
|  | ObjectType | type,
|  | const string & | ver,
|  | EncodingType | enc,
|  | const time_t | last_modified
| ) |  |

Generate an HTTP 1.0 response header for a text document. This is used when returning a serialized DAS or DDS object.

Deprecated:

Parameters

  out | Write the MIME header to this FILE pointer.
  type | The type of this this response. Defaults to application/octet-stream.
  ver | The version string; denotes the libdap implementation version.
  enc | How is this response encoded? Can be plain or deflate or the x_... versions of those. Default is x_plain.
  last_modified | The time to use for the Last-Modified header value. Default is zero which means use the current time.

Definition at line 379 of file mime_util.cc.

## set_mime_text() [2/3]

void libdap::set_mime_text | ( | ostream & | strm,
|  | ObjectType | type,
|  | const string & | ver,
|  | EncodingType | enc,
|  | const time_t | last_modified
| ) |  |

Generate an HTTP 1.0 response header for a text document. This is used when returning a serialized DAS or DDS object.

Deprecated:

Parameters

  strm | Write the MIME header to this stream.
  type | The type of this this response. Defaults to application/octet-stream.
  ver | The version string; denotes the libdap implementation version.
  enc | How is this response encoded? Can be plain or deflate or the x_... versions of those. Default is x_plain.
  last_modified | The time to use for the Last-Modified header value. Default is zero which means use the current time.

Definition at line 401 of file mime_util.cc.

## set_mime_text() [3/3]

void libdap::set_mime_text | ( | ostream & | strm,
|  | ObjectType | type,
|  | EncodingType | enc,
|  | const time_t | last_modified,
|  | const string & | protocol
| ) |  |

Generate an HTTP 1.0 response header for a text document. This is used when returning a serialized DAS or DDS object.

Note
  In Hyrax these headers are not used. Instead the front end of the server will build the response headers

Parameters

  strm | Write the MIME header to this stream.
  type | The type of this this response. Defaults to application/octet-stream.
  ver | The version string; denotes the libdap implementation version.
  enc | How is this response encoded? Can be plain or deflate or the x_... versions of those. Default is x_plain.
  last_modified | The time to use for the Last-Modified header value. Default is zero which means use the current time.

Definition at line 456 of file mime_util.cc.

## size_ok()

bool libdap::size_ok | ( | unsigned int | sz,
|  | unsigned int | nelem
| ) |  |

sanitize the size of an array. Test for integer overflow when dynamically allocating an array.

Parameters

  nelem | Number of elements.
  sz | size of each element.

Returns
  True if the `nelem` elements of `sz` size will overflow an array.

Definition at line 1152 of file util.cc.

## StrCmp()

template<class T1 , class T2 >

bool libdap::StrCmp | ( | int | op,
|  | T1 | v1,
|  | T2 | v2
| ) |  |

Compare two string types. This class is one implementation of the comparison policy used by rops.

See also
  rops

Definition at line 169 of file Operators.h.

## String_to_AttrType()

AttrType libdap::String_to_AttrType | ( | const string & | s | ) |

Definition at line 141 of file AttrTable.cc.

## StringToD4AttributeType()

D4AttributeType libdap::StringToD4AttributeType | ( | string | s | ) |

Definition at line 110 of file D4Attributes.cc.

## systime()

string libdap::systime | ( |  | ) |

Use the system time() function to get the current time. Return a string, removing the trailing newline that time() includes in its response.

Returns
  A C++ string with the current system time as formatted by time()

Definition at line 544 of file util.cc.

## type_name()

string libdap::type_name | ( | Type | t | ) |

Return the type name. This function provides backward compatibility for older code that predates, and has not been ported to, DAP4. It is prejudiced toward DAP4, but if no D4 type name can be found, it types D2. If neither would return a type name, and InternalErr object is thrown.

Parameters

  t | The DAP2/DAP4 type

Returns
  A string naming the type, suitable for humans

Exceptions

  InternalErr | If not such type can be found

Definition at line 763 of file util.cc.

## unescape_double_quotes()

string libdap::unescape_double_quotes | ( | string | source | ) |

Rip through a string and replace all the escaped double quotes with regular double quotes.

Parameters

  source |

Returns
  result

Definition at line 516 of file escaping.cc.

## unescattr()

string libdap::unescattr | ( | string | s | ) |

Un-escape special characters, quotes and backslashes from an HDF attribute.

Note: A regex to match one \ must be defined as: Regex foo = "\\\\"; because both C++ strings and GNU's Regex also employ \ as an escape character!

Parameters

  s | The escaped attribute.

Returns
  The unescaped attribute.

Definition at line 436 of file escaping.cc.

## unhexstring()

string libdap::unhexstring | ( | string | s | ) |

Definition at line 91 of file escaping.cc.

## unique_names()

bool libdap::unique_names | ( | vector< BaseType * > | l,
|  | const string & | var_name,
|  | const string & | type_name,
|  | string & | msg
| ) |  |

Definition at line 481 of file util.cc.

## unoctstring()

string libdap::unoctstring | ( | string | s | ) |

Definition at line 113 of file escaping.cc.

## www2id()

string libdap::www2id | ( | const string & | in,
|  | const string & | escape,
|  | const string & | except
| ) |  |

Given a string that contains WWW escape sequences, translate those escape sequences back into the ASCII characters they represent. Return the modified string.

-Places in the dap code where www2id() is called:

1. Array::append_dim() the name is decoded before it is added
2. AttrTable::set_name(), AttrTable::append_attr(), AttrTable::append_container(), AttrTable::del_attr(), AttrTable::add_container_alias(), AttrTable::add_value_alias() names are decoded before that are set/used.
3. BaseType::set_name() Names are decoded before they are set
4. When the constraint expression parser looks for a variable, the name is first decoded.
5. DAS::DAS() Named attribute containers are decoded
6. DDS::var() When a DDS searches for a variable, the name is first decoded.
7. Grid::var(), Sequence::var(), Structure::var() Variable names are decoded.

-In the server code:

1. ResponseBuilder::initialize() The dataset name is decoded except that %20 is not removed.
2. ResponseBuilder::set_ce() The CE is decoded, except for spaces (%20).
3. ResponseBuilder::set_dataset_name() same logic as the first case.
4. The ResponseBuilder methods supersede methods with the same names from DODSFilter, which is still in the code although deprecated.

Parameters

  in | The string to modify.
  escape | The character used to signal the beginning of an escape sequence. default: "%"
  except | If there are some escape codes that should not be removed by this call (e.g., you might not want to remove spaces, %20) use this parameter to specify those codes. The function will then transform all escapes except those given. For example, to suppress translation of both spaces and the ampersand, pass "%20%26" for 'except'. default: ""

Returns
  The modified string.

Definition at line 220 of file escaping.cc.

## xml2id()

string libdap::xml2id | ( | string | in | ) |

Given a string that contains XML escape sequences (i.e., entities), translate those back into ASCII characters. Return the modified string.

Parameters

  in | The string to modify.

Returns
  The modified string.

Definition at line 322 of file escaping.cc.

## Variable Documentation

## c_dap40_namespace

const string libdap::c_dap40_namespace = "http://xml.opendap.org/ns/DAP/4.0#"

Definition at line 41 of file DMR.h.

## dods_keep_temps

int libdap::dods_keep_temps = 0

Definition at line 83 of file HTTPConnect.cc.

## DODS_MAX_ARRAY

const int libdap::DODS_MAX_ARRAY = DODS_INT_MAX

Definition at line 61 of file Array.h.

## double_quote

const string libdap::double_quote = "\""

Definition at line 1214 of file AttrTable.cc.

## line_length

const size_t libdap::line_length = 1024

Definition at line 819 of file mime_util.cc.

## max_str_len

const unsigned int libdap::max_str_len = DODS_USHRT_MAX - 1

Definition at line 54 of file Str.h.

## max_url_len

const unsigned int libdap::max_url_len = 255

Definition at line 50 of file Url.h.

## usage

const string libdap::usage

Initial value:
=
"Usage: <handler name> -o <response> -u <url> [options ...] [data set]\n\
\n\
options: -o <response>: DAS, DDS, DataDDS, DDX, BLOB or Version (Required)\n\
-u <url>: The complete URL minus the CE (required for DDX)\n\
-c: Compress the response using the deflate algorithm.\n\
-e <expr>: When returning a DataDDS, use <expr> as the constraint.\n\
-v <version>: Use <version> as the version number\n\
-d <dir>: Look for ancillary file in <dir> (deprecated).\n\
-f <file>: Look for ancillary data in <file> (deprecated).\n\
-r <dir>: Use <dir> as a cache directory\n\
-l <time>: Conditional request; if data source is unchanged since\n\
<time>, return an HTTP 304 response.\n\
-t <seconds>: Timeout the handler after <seconds>.\n\
-h: This message."

Definition at line 90 of file DODSFilter.cc.

## www_trace

int libdap::www_trace = 0

Definition at line 77 of file HTTPConnect.cc.

## www_trace_extensive

int libdap::www_trace_extensive = 0

Definition at line 80 of file HTTPConnect.cc.