libdap Namespace Reference


Classes

class  AISConnect
class  AISDatabaseParser
class  AISDatabaseReadFailed
class  AISDatabaseWriteFailed
class  AISMerge
 Merge AIS resources. More...
class  AISResources
 Manage AIS resources. More...
class  AlarmHandler
class  Ancillary
class  Array
 A multidimensional array of identical data types. More...
class  ArrayGeoConstraint
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
struct  Clause
 Holds a fragment of a constraint expression. More...
class  Cmp
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  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  DAS
 Hold attribute data for a DAP2 dataset. More...
class  DataDDS
 Holds a DAP2 DDS. More...
class  DDS
class  DDXParseFailed
class  DDXParser
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  GeoConstraint
class  Grid
 Holds the Grid data type. More...
class  GridGeoConstraint
struct  gse_arg
class  GSEClause
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  InternalErr
 A class for software fault reporting. More...
class  Marshaller
 abstract base class used to marshall/serialize dap data objects More...
class  NoSuchPrimaryResource
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  Resource
 Associate a rule with an ancillary resource. More...
class  Response
class  ResponseTooBigErr
class  rvalue
class  Sequence
 Holds a sequence. More...
class  SignalHandler
class  SignalHandlerRegisteredErr
class  StdinResponse
 Encapsulate a response read from stdin. More...
class  Str
 Holds character string data. More...
class  StrCmp
class  Structure
 Holds a structure (aggregate) type. More...
class  SUCmp
class  TestHandler
class  UInt16
 Holds an unsigned 16-bit integer. More...
class  UInt32
 Holds a 32-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  USCmp
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 to marshall/serialize dap data objects to a C++ iostream using XDR More...
class  XDRUtils

Typedefs

typedef vector< BaseType * > BaseTypeRow
typedef uint8_t dods_byte
typedef float dods_float32
typedef double dods_float64
typedef int16_t dods_int16
typedef int32_t dods_int32
typedef uint16_t dods_uint16
typedef uint32_t dods_uint32
typedef int ErrorCode
 An enumerated type for common errors.
typedef vector< ResourceResourceVector
typedef
ResourceVector::const_iterator 
ResourceVectorCIter
typedef ResourceVector::iterator ResourceVectorIter
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)

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
}
enum  CacheDisconnectedMode { DISCONNECT_NONE = 0, DISCONNECT_NORMAL = 1, DISCONNECT_EXTERNAL = 2 }
enum  EncodingType { unknown_enc, deflate, x_plain }
 The type of encoding used on the current stream. More...
enum  ObjectType {
  unknown_type, dods_das, dods_dds, dods_data,
  dods_error, web_error, dap4_ddx, dap4_datax,
  dap4_errorx
}
 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  relop {
  dods_nop_op, dods_greater_op, dods_greater_equal_op, dods_less_op,
  dods_less_equal_op, dods_equal_op, dods_not_equal_op
}
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_array_c, dods_structure_c,
  dods_sequence_c, dods_grid_c
}
 Identifies the data type. More...

Functions

rvalue_listappend_rvalue_list (rvalue_list *rvals, rvalue *rv)
string AttrType_to_String (const AttrType at)
BaseType ** build_btp_args (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)
 Is the value a valid float?
int check_float64 (const char *val)
int check_int16 (const char *val)
 Is the value a valid integer?
int check_int32 (const char *val)
int check_uint16 (const char *val)
int check_uint32 (const char *val)
int check_url (const char *val)
 Is the value a valid URL?
void close_temp (FILE *s, const string &name)
FILE * compressor (FILE *output, int &childpid)
string dap_version ()
string date_time_str (time_t *calendar, bool local)
bool deflate_exists ()
unsigned dods_max (int i1, int i2)
const char * dods_progress ()
bool double_eq (double lhs, double rhs, double epsilon=1.0e-5)
void downcase (string &s)
string esc2underscore (string s)
string escattr (string s)
double * extract_double_array (Array *a)
double extract_double_value (BaseType *arg)
string extract_string_argument (BaseType *arg)
string file_to_string (FILE *fp)
bool found_override (string name, string &doc)
void func_version (int argc, BaseType *argv[], DDS &dds, BaseType **btpp)
void function_geoarray (int argc, BaseType *argv[], DDS &, BaseType **btpp)
void function_geogrid (int argc, BaseType *argv[], DDS &, BaseType **btpp)
void function_grid (int argc, BaseType *argv[], DDS &, BaseType **btpp)
void function_linear_scale (int argc, BaseType *argv[], DDS &, BaseType **btpp)
void function_version (int, BaseType *[], DDS &, BaseType **btpp)
ObjectType get_description_type (const string &value)
int get_hash (const string &url)
string get_temp_file (FILE *&stream) throw (InternalErr)
ObjectType get_type (const string &value)
string get_user_supplied_docs (string name, string cgi)
 Look for the user supplied CGI- and dataset-specific HTML* documents.
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_hop_by_hop_header (const string &header)
bool is_keyword (string id, const string &keyword)
bool is_quoted (const string &s)
const char * libdap_name ()
const char * libdap_root ()
const char * libdap_version ()
rvalue_listmake_rvalue_list (rvalue *rv)
string munge_error_message (string msg)
string octstring (unsigned char val)
ostream & operator<< (ostream &os, const AISResources &ais_res)
ostream & operator<< (ostream &os, const Resource &r)
void parse_error (const char *msg, const int line_num, const char *context)
time_t parse_time (const char *str, bool expand)
string path_to_filename (string path)
string prune_spaces (const string &name)
void register_functions (ConstraintEvaluator &ce)
bool remove_mime_header (FILE *in)
 Read and discard the MIME header of the stream in.
string remove_quotes (const string &s)
template<class T1 , class T2 , class C >
bool rops (T1 a, T2 b, int op)
void save_str (string &dst, const char *src, const int)
void save_str (char *dst, const char *src, const int line_num)
 Save a string to a temporary variable during the parse.
void set_array_using_double (Array *dest, double *src, int src_len)
AttrType String_to_AttrType (const string &s)
string systime ()
FILE * text_to_temp (string text)
string unescattr (string s)
string unhexstring (string s)
bool unique_names (vector< BaseType * > l, const string &var_name, const string &type_name, string &msg)
bool unit_or_name_match (set< string > units, set< string > names, const string &var_units, const string &var_name)
string unoctstring (string s)
string www2id (const string &in, const string &escape, const string &except)
string xml2id (string in)
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)
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)
CGI Utilities
A collection of useful functions for writing 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 DODSFilter. Always choose to use that class over these functions if you can.

See also:
DODSFilter


bool do_data_transfer (bool compression, FILE *data_stream, DDS &dds, const string &dataset, const string &constraint)
bool do_version (const string &script_ver, const string &dataset_ver)
 Send a version number.
void ErrMsgT (const string &Msgt)
 Logs an error message.
time_t last_modified_time (const string &name)
string name_path (const string &path)
 Returns the filename portion of a pathname.
string rfc822_date (const time_t t)
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 (const string &msg, const int line_num, const char *context)
void parse_error (parser_arg *arg, const char *msg, const int line_num, const char *context)
Security functions


bool pathname_ok (const string &path, bool strict)
 Does the string name a potentailly valid pathname? Test the given pathname to verfiy 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.
bool size_ok (uint sz, uint nelem)
 sanitize the size of an array. Test for integer overflow when dynamically allocating an array.
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.

See also:
DODSFilter


void set_mime_binary (ostream &strm, ObjectType type, const string &ver, EncodingType enc, const time_t last_modified)
void set_mime_binary (FILE *out, ObjectType type, const string &ver, EncodingType enc, const time_t last_modified)
void set_mime_error (ostream &strm, int code, const string &reason, const string &version)
void set_mime_error (FILE *out, int code, const string &reason, const string &version)
void set_mime_html (ostream &strm, ObjectType type, const string &ver, EncodingType enc, const time_t last_modified)
void set_mime_html (FILE *out, ObjectType type, const string &ver, EncodingType enc, const time_t last_modified)
void set_mime_not_modified (ostream &strm)
 Send a `Not Modified' response.
void set_mime_not_modified (FILE *out)
 Send a `Not Modified' response.
void set_mime_text (ostream &strm, ObjectType type, const string &ver, EncodingType enc, const time_t last_modified)
void set_mime_text (FILE *out, ObjectType type, const string &ver, EncodingType enc, const time_t last_modified)

Variables

int dods_keep_temps = 0
const int DODS_MAX_ARRAY = DODS_INT_MAX
const string double_quote = "\""
const unsigned int max_str_len = DODS_USHRT_MAX - 1
const unsigned int max_url_len = 255
const string usage
int www_trace = 0

Typedef Documentation

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 68 of file Sequence.h.

typedef uint8_t libdap::dods_byte

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

typedef float libdap::dods_float32

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

typedef double libdap::dods_float64

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

typedef int16_t libdap::dods_int16

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

typedef int32_t libdap::dods_int32

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

typedef uint16_t libdap::dods_uint16

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

typedef uint32_t libdap::dods_uint32

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

typedef int libdap::ErrorCode

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 55 of file Error.h.

Definition at line 49 of file AISResources.h.

typedef ResourceVector::const_iterator libdap::ResourceVectorCIter

Definition at line 51 of file AISResources.h.

typedef ResourceVector::iterator libdap::ResourceVectorIter

Definition at line 50 of file AISResources.h.

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

Definition at line 67 of file RValue.h.

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

Definition at line 68 of file RValue.h.

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

Definition at line 69 of file RValue.h.

This type holds all of the values of a Sequence.

Definition at line 71 of file Sequence.h.

typedef void libdap::Sigfunc(int)

Definition at line 37 of file SignalHandler.h.


Enumeration Type Documentation

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

See also:
AttrTable
Enumerator:
Attr_unknown 
Attr_container 
Attr_byte 
Attr_int16 
Attr_uint16 
Attr_int32 
Attr_uint32 
Attr_float32 
Attr_float64 
Attr_string 
Attr_url 

Definition at line 76 of file AttrTable.h.

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.

Enumerator:
DISCONNECT_NONE 
DISCONNECT_NORMAL 
DISCONNECT_EXTERNAL 

Definition at line 47 of file HTTPCacheDisconnectedMode.h.

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 };

Enumerator:
unknown_enc 
deflate 
x_plain 

Definition at line 46 of file EncodingType.h.

When a version 2.x or greater DAP data server sends an object, it uses the Content-Description header of the response to indicate the type of object contained in the response. During the parse of the header a member of Connect is set to one of these values so that other mfuncs can tell the type of object without parsing the stream themselves.

     enum ObjectType {
       unknown_type,
       dods_das,
       dods_dds,
       dods_data,
       dods_error,
       web_error,
       dap4_ddx,
       dap4_datax,
       dap4_errorx
     };
     
Enumerator:
unknown_type 
dods_das 
dods_dds 
dods_data 
dods_error 
web_error 
dap4_ddx 
dap4_datax 
dap4_errorx 

Definition at line 55 of file ObjectType.h.

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
    };

See also:
Grid

BaseType

Enumerator:
nil 
array 
maps 

Definition at line 96 of file BaseType.h.

Enumerator:
dods_nop_op 
dods_greater_op 
dods_greater_equal_op 
dods_less_op 
dods_less_equal_op 
dods_equal_op 
dods_not_equal_op 

Definition at line 56 of file GSEClause.h.

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

See also:
BaseType
Enumerator:
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_array_c 
dods_structure_c 
dods_sequence_c 
dods_grid_c 

Definition at line 129 of file BaseType.h.


Function Documentation

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

Definition at line 456 of file util.cc.

Referenced by double_to_string().

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

Definition at line 419 of file util.cc.

Referenced by libdap::InternalErr::InternalErr(), long_to_string(), and parse_error().

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

Definition at line 73 of file RValue.cc.

Referenced by make_rvalue_list().

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 58 of file AttrTable.cc.

References Attr_byte, Attr_container, Attr_float32, Attr_float64, Attr_int16, Attr_int32, Attr_string, Attr_uint16, Attr_uint32, and Attr_url.

Referenced by libdap::AttrTable::dump(), and libdap::AttrTable::get_type().

BaseType ** libdap::build_btp_args ( 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
dataset Use this when evaluating functions.

Definition at line 93 of file RValue.cc.

References long_to_string(), malformed_expr, and size_ok().

Referenced by libdap::rvalue::bvalue(), and libdap::Clause::value().

Here is the call graph for this function:

string libdap::char2ASCII ( string  s,
const string  escape = "%[0-7][0-9a-fA-F]" 
)

int libdap::check_byte ( const char *  val  ) 

Check to see if val is a valid byte value. If not, generate an error message using parser_error(). There are two versions of check_byte(), one which calls parser_error() and prints an error message to stderr an one which calls parser_error() and generates and Error object.

Returns:
Returns: True if val is a byte value, False otherwise.

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

References DBG, DODS_SCHAR_MIN, DODS_UCHAR_MAX, FALSE, and TRUE.

int libdap::check_float32 ( const char *  val  ) 

Like check_byte() but for 64-bit float values.

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

References DBG, DODS_FLT_MAX, DODS_FLT_MIN, FALSE, and TRUE.

int libdap::check_float64 ( const char *  val  ) 

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

References DBG, DODS_DBL_MAX, DODS_DBL_MIN, FALSE, and TRUE.

int libdap::check_int16 ( const char *  val  ) 

Like check_byte() but for 32-bit integers (check_uint() is for unsigned integers).

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

References DODS_SHRT_MAX, DODS_SHRT_MIN, FALSE, and TRUE.

int libdap::check_int32 ( const char *  val  ) 

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

References DODS_INT_MAX, DODS_INT_MIN, FALSE, and TRUE.

int libdap::check_uint16 ( const char *  val  ) 

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

References DODS_USHRT_MAX, FALSE, and TRUE.

int libdap::check_uint32 ( const char *  val  ) 

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

References FALSE, and TRUE.

int libdap::check_url ( const char *  val  ) 

Currently this function always returns true.

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

References TRUE.

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

Close the temporary file opened for read_url().

Definition at line 796 of file HTTPConnect.cc.

References DBG.

Referenced by libdap::HTTPResponse::~HTTPResponse().

FILE* libdap::compressor ( FILE *  output,
int &  childpid 
)

string libdap::dap_version (  ) 

Get the version of the DAP library.

Definition at line 478 of file util.cc.

References libdap_version().

Here is the call graph for this function:

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 285 of file util_mit.cc.

Referenced by libdap::HTTPCache::get_conditional_request_headers().

bool libdap::deflate_exists (  ) 

bool libdap::do_data_transfer ( bool  compression,
FILE *  data_stream,
DDS &  dds,
const string &  dataset,
const string &  constraint 
)

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

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 109 of file cgi_util.cc.

References CRLF, DAP_PROTOCOL_VERSION, and DVR.

Referenced by libdap::DODSFilter::send_version_info().

unsigned libdap::dods_max ( int  i1,
int  i2 
) [inline]

const char* libdap::dods_progress (  ) 

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 92 of file ce_functions.cc.

Referenced by function_linear_scale().

string libdap::double_to_string ( const double &  num  ) 

Definition at line 467 of file util.cc.

References append_double_to_string().

Referenced by libdap::GeoConstraint::set_bounding_box().

Here is the call graph for this function:

void libdap::downcase ( string &  s  ) 

Definition at line 375 of file util.cc.

Referenced by is_keyword(), and String_to_AttrType().

void libdap::ErrMsgT ( const string &  Msgt  ) 

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.

Returns:
void

Definition at line 141 of file cgi_util.cc.

Referenced by libdap::DODSFilter::print_usage().

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 299 of file escaping.cc.

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 313 of file escaping.cc.

References octstring().

Referenced by libdap::Str::print_val().

Here is the call graph for this function:

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[] can be used when you are done the data.

Definition at line 227 of file ce_functions.cc.

References dods_array_c, dods_byte_c, dods_float32_c, dods_float64_c, dods_int16_c, dods_int32_c, dods_str_c, dods_uint16_c, dods_uint32_c, dods_url_c, libdap::BaseType::is_simple_type(), malformed_expr, libdap::BaseType::name(), libdap::BaseType::read_p(), libdap::BaseType::type(), and libdap::Vector::var().

Referenced by function_linear_scale().

Here is the call graph for this function:

double libdap::extract_double_value ( BaseType *  arg  ) 

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

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 271 of file ce_functions.cc.

References dods_byte_c, dods_float32_c, dods_float64_c, dods_int16_c, dods_int32_c, dods_str_c, dods_uint16_c, dods_uint32_c, dods_url_c, libdap::BaseType::is_simple_type(), malformed_expr, libdap::BaseType::read_p(), and libdap::BaseType::type().

Referenced by function_geoarray(), function_geogrid(), and function_linear_scale().

Here is the call graph for this function:

string libdap::extract_string_argument ( BaseType *  arg  ) 

Given a BaseType pointer, extract the string value it contains and return it.

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 107 of file ce_functions.cc.

References DBG, dods_str_c, malformed_expr, libdap::BaseType::read_p(), and libdap::BaseType::type().

Referenced by function_geoarray().

Here is the call graph for this function:

string libdap::file_to_string ( FILE *  fp  ) 

Read stuff from a file and dump it into a string. This assumes the file holds character data only. Intended for testing...

Parameters:
fp Read from this file
Returns:
Returns a string which holds the character data.

Definition at line 597 of file util.cc.

bool libdap::found_override ( string  name,
string &  doc 
)

Look for the override file by taking the dataset name and appending `.ovr' to it. If such a file exists, then read it in and store the contents in doc. Note that the file contents are not checked to see if they are valid HTML (which they must be).

Returns:
True if the `override file' is present, false otherwise. in the later case doc's contents are undefined.

Definition at line 689 of file cgi_util.cc.

void libdap::func_version ( int  argc,
BaseType *  argv[],
DDS &  dds,
BaseType **  btpp 
)

void libdap::function_geoarray ( int  argc,
BaseType *  argv[],
DDS &  ,
BaseType **  btpp 
)

Perform a selection on the array using geographical coordinates. This function takes several groups of arguments.

  • geoarray(var, top, left, bottom, right)
  • geoarray(var, top, left, bottom, right, var_top, v_left, v_bottom, v_right)
  • geoarray(var, top, left, bottom, right, var_top, v_left, v_bottom, v_right, projection, datum)

Note:
Only the plat-carre projection and wgs84 datum are currently supported.
Parameters:
argc 
argv 
dds 
dataset 
Returns:
The Array, constrained by the selection
Exceptions:
Error Thrown if thins go awry.

Definition at line 915 of file ce_functions.cc.

References libdap::ArrayGeoConstraint::apply_constraint_to_data(), DBG, extract_double_value(), extract_string_argument(), libdap::ArrayGeoConstraint::get_constrained_array(), malformed_expr, libdap::BaseType::ptr_duplicate(), libdap::GeoConstraint::set_bounding_box(), and libdap::Str::set_value().

Referenced by register_functions().

Here is the call graph for this function:

void libdap::function_geogrid ( int  argc,
BaseType *  argv[],
DDS &  ,
BaseType **  btpp 
)

The geogrid function returns the part of a Grid which includes a geographically specified rectangle. The arguments to the function are the name of a Grid, the left-top and right-bottom points of the rectangle and zero or more relational expressions of the sort that the grid function accepts. The constraints on the arguments are:

  • The Grid must have Latitude and Longitude map vectors. Those are discovered by looking for map vectors which satisfy enough of any one of a set of conventions to make the identification of those map vectors positive or by guessing which maps are which. The set of conventions supported is: COARDS, CF 1.0, GDT and CSC (see http://www.unidata.ucar.edu/software/netcdf/conventions.html). If the geogrid guesses at the maps, it adds an attribute (geogrid_warning) which says so. (in version 1.1)
  • The rectangle corner points are in Longitude-Latitude. Longitude may be given using -180 to 180 or 0 to 360. For data sources with global coverage, geogrid assumes that the Longitude axis is circular. For requests made using 0/359 notation, it assumes it is modulus 360. Requests made using -180/179 notation cannot use values outside that range.
  • The notation used to specify the rectangular region determines the notation used in the longitude/latitude map vectors of the Grid returned by the function.
  • There are no restrictions on the relational expressions beyond those for the grid() (see func_grid_select()) function.

Note:
The geogrid() function is implemented as a 'BaseType function' which means that there can be only one function per request and no other variables may be named in the request.
Parameters:
argc The number of values in argv.
argv An array of BaseType pointers which hold the arguments to be passed to geogrid. The arguments may be Strings, Integers, or Reals, subject to the above constraints.
dds The DDS which holds the Grid. This DDS must include attributes.
dataset Name of the dataset.
Returns:
The constrained and read Grid, ready to be sent.

Definition at line 540 of file ce_functions.cc.

References libdap::GridGeoConstraint::apply_constraint_to_data(), DBG, extract_double_value(), libdap::Grid::get_array(), libdap::GridGeoConstraint::get_constrained_grid(), libdap::gse_arg::get_gsec(), malformed_expr, libdap::Grid::map_begin(), libdap::Grid::map_end(), libdap::BaseType::ptr_duplicate(), libdap::BaseType::read(), libdap::GeoConstraint::set_bounding_box(), libdap::Vector::set_read_p(), and libdap::Str::set_value().

Referenced by register_functions().

Here is the call graph for this function:

void libdap::function_grid ( int  argc,
BaseType *  argv[],
DDS &  ,
BaseType **  btpp 
)

The grid function uses a set of relational expressions to form a selection within a Grid variable based on the values in the Grid's map vectors. Thus, if a Grid has a 'temperature' map which ranges from 0.0 to 32.0 degrees, it's possible to request the values of the Grid that fall between 10.5 and 12.5 degrees without knowing to which array indexes those values correspond. The function takes one or more arguments:

  • The name of a Grid.
  • Zero or more strings which hold relational expressions of the form:
    • <map var> <relop> <constant>
    • <constant> <relop> <map var> <relop> <constant>

Each of the relation expressions is applied to the Grid and the result is returned.

Note:
Since this is a function and one of the arguments is the grid, the grid is read (using the Grid::read() method) at the time the argument list is built.
Todo:
In order to be used by geogrid() , this code may have to be modified so that the maps and array are not re-read by the serialize() method. It might also be a good idea to change from the '?grid(SST,"10<time<20")' syntax in a URL to '?SST&grid(SST,"10<time<20")' even though it's more verbose in the URL, it would make the function a true 'selection operator' and allow several grids to be returned with selections in one request.
Parameters:
argc The number of values in argv.
argv An array of BaseType pointers which hold the arguments to be passed to geogrid. The arguments may be Strings, Integers, or Reals, subject to the above constraints.
dds The DDS which holds the Grid.
dataset Name of the dataset.
See also:
geogrid() (func_geogrid_select) A function which has logic specific to longitude/latitude selection.

Definition at line 429 of file ce_functions.cc.

References DBG, libdap::Grid::get_array(), libdap::gse_arg::get_gsec(), malformed_expr, libdap::Grid::map_begin(), libdap::Grid::map_end(), libdap::Grid::ptr_duplicate(), libdap::BaseType::read(), libdap::Vector::set_send_p(), and libdap::Str::set_value().

Referenced by register_functions().

Here is the call graph for this function:

void libdap::function_linear_scale ( int  argc,
BaseType *  argv[],
DDS &  ,
BaseType **  btpp 
)

Given a BaseType, scale it using 'y = mx + b'. Either provide the constants 'm' and 'b' or the function will look for the COARDS attributes 'scale_factor' and 'add_offset'.

Parameters:
argc 
argv 
dds 
dataset 
Returns:
The scaled variable, represented using Float64
Exceptions:
Error Thrown if scale_factor is not given and the COARDS attributes cannot be found OR if the source variable is not a numeric scalar, Array or Grid.

Definition at line 752 of file ce_functions.cc.

References libdap::Array::add_var(), DBG, DBG2, dods_grid_c, dods_str_c, dods_url_c, double_eq(), extract_double_array(), extract_double_value(), libdap::BaseType::get_parent(), libdap::Vector::length(), malformed_expr, libdap::BaseType::name(), libdap::BaseType::read(), libdap::Vector::set_send_p(), libdap::Vector::set_value(), libdap::Str::set_value(), libdap::BaseType::type(), libdap::BaseType::val2buf(), and libdap::Vector::val2buf().

Referenced by register_functions().

Here is the call graph for this function:

void libdap::function_version ( int  ,
BaseType *  [],
DDS &  ,
BaseType **  btpp 
)

This server-side function returns version information for the server-side functions.

Definition at line 311 of file ce_functions.cc.

References libdap::Str::set_value().

Referenced by register_functions().

Here is the call graph for this function:

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 teh HTTP response header

Definition at line 149 of file HTTPConnect.cc.

References dap4_datax, dap4_ddx, dap4_errorx, dods_das, dods_data, dods_dds, dods_error, unknown_type, and web_error.

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 97 of file HTTPCacheTable.cc.

Referenced by libdap::HTTPCacheTable::CacheEntry::CacheEntry(), libdap::HTTPCacheTable::get_locked_entry_from_cache_table(), libdap::HTTPCacheTable::get_write_locked_entry_from_cache_table(), and libdap::HTTPCacheTable::remove_entry_from_cache_table().

string libdap::get_temp_file ( FILE *&  stream  )  throw (InternalErr)

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 773 of file HTTPConnect.cc.

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:
Use get_description_type instead - there are two other get_type() functions in libdap.

Definition at line 121 of file HTTPConnect.cc.

References dap4_datax, dap4_ddx, dap4_errorx, dods_das, dods_data, dods_dds, dods_error, get_type(), unknown_type, and web_error.

Referenced by get_type().

Here is the call graph for this function:

string libdap::get_user_supplied_docs ( string  name,
string  cgi 
)

Look in the CGI directory (given by cgi) for a per-cgi HTML* file. Also look for a dataset-specific HTML* document. Catenate the documents and return them in a single String variable.

Similarly, to locate the dataset-specific HTML* file it catenates `.html' to name, where name is the name of the dataset. If the filename part of name is of the form [A-Za-z]+[0-9]*.* then this function also looks for a file whose name is [A-Za-z]+.html For example, if name is .../data/fnoc1.nc this function first looks for .../data/fnoc1.nc.html. However, if that does not exist it will look for .../data/fnoc.html. This allows one `per-dataset' file to be used for a collection of files with the same root name.

Note:
An HTML* file contains HTML without the html, head or body tags (my own notation).
Returns:
A String which contains these two documents catenated. Documents that don't exist are treated as `empty'.

Definition at line 752 of file cgi_util.cc.

References libdap::Ancillary::find_group_ancillary_file().

Here is the call graph for this function:

string libdap::hexstring ( unsigned char  val  ) 

Definition at line 80 of file escaping.cc.

Referenced by 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 The string in which to replace characters.
allowable The set of characters that are allowed in a URI. default: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+_/.\\*"
See also:
id2www_ce()
Returns:
The modified identifier.

Definition at line 152 of file escaping.cc.

References hexstring().

Referenced by id2www_ce(), libdap::DDS::print(), libdap::AttrTable::print(), libdap::DDS::print_constrained(), libdap::Grid::print_decl(), libdap::Constructor::print_decl(), libdap::BaseType::print_decl(), libdap::Array::print_decl(), and libdap::AttrTable::simple_print().

Here is the call graph for this function:

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 175 of file escaping.cc.

References id2www().

Referenced by libdap::Connect::request_das(), libdap::Connect::request_data(), libdap::Connect::request_dds(), libdap::Connect::request_ddx(), libdap::Connect::request_protocol(), and libdap::Connect::request_version().

Here is the call graph for this function:

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 249 of file escaping.cc.

Referenced by libdap::Grid::print_xml(), libdap::DDS::print_xml(), libdap::Constructor::print_xml(), libdap::BaseType::print_xml(), libdap::AttrTable::print_xml(), and libdap::Array::print_xml_core().

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 951 of file HTTPCache.cc.

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

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

References DBG, downcase(), and prune_spaces().

Here is the call graph for this function:

bool libdap::is_quoted ( const string &  s  ) 

Definition at line 382 of file util.cc.

Referenced by remove_quotes().

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 278 of file cgi_util.cc.

Referenced by libdap::DODSFilter::get_das_last_modified_time(), libdap::DODSFilter::get_data_last_modified_time(), libdap::DODSFilter::get_dataset_last_modified_time(), and libdap::DODSFilter::get_dds_last_modified_time().

const char * libdap::libdap_name (  ) 

Definition at line 190 of file util.cc.

References PACKAGE_NAME.

const char * libdap::libdap_root (  ) 

Definition at line 168 of file util.cc.

References LIBDAP_ROOT.

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 183 of file util.cc.

References PACKAGE_VERSION.

Referenced by dap_version().

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

rvalue_list * libdap::make_rvalue_list ( rvalue *  rv  ) 

Definition at line 58 of file RValue.cc.

References append_rvalue_list().

Here is the call graph for this function:

string libdap::munge_error_message ( string  msg  ) 

Definition at line 393 of file escaping.cc.

string libdap::name_path ( const string &  path  ) 

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 190 of file cgi_util.cc.

References FILE_DELIMITER.

string libdap::octstring ( unsigned char  val  ) 

Definition at line 102 of file escaping.cc.

Referenced by escattr().

ostream& libdap::operator<< ( ostream &  os,
const AISResources &  ais_res 
)

Output the XML for a collection of AIS resources. This function is a friend of the AISResource class.

See also:
AISResources

Definition at line 62 of file AISResources.cc.

ostream& libdap::operator<< ( ostream &  os,
const Resource &  r 
)

Output the XML fragment for a Resource. This function is a friend of the Resource class.

Parameters:
os output stream
r Resource to write out.
See also:
Resource.

Definition at line 46 of file AISResources.cc.

References libdap::Resource::fallback, and libdap::Resource::overwrite.

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

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

References parse_error().

Here is the call graph for this function:

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

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

References append_long_to_string().

Here is the call graph for this function:

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

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

References append_long_to_string(), FALSE, libdap::parser_arg::set_error(), libdap::parser_arg::set_status(), and unknown_error.

Referenced by parse_error(), and save_str().

Here is the call graph for this function:

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.

Definition at line 133 of file util_mit.cc.

References DBG.

Referenced by libdap::HTTPCacheTable::parse_headers(), and libdap::HTTPCache::set_cache_control().

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 500 of file util.cc.

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

Note:
Using this function does not guarentee 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 638 of file util.cc.

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.

Todo:
Is this still needed? This function may predate the switch from libwww to libcurl and the latter may not need to have spaces removed.
Parameters:
name The URL to process
Returns:
Returns a new string object that contains the pruned URL.

Definition at line 96 of file util.cc.

Referenced by libdap::Connect::Connect(), and is_keyword().

void libdap::register_functions ( ConstraintEvaluator &  ce  ) 

bool libdap::remove_mime_header ( FILE *  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.

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

Definition at line 716 of file cgi_util.cc.

References CRLF.

string libdap::remove_quotes ( const string &  s  ) 

Definition at line 388 of file util.cc.

References is_quoted().

Here is the call graph for this function:

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 259 of file cgi_util.cc.

Referenced by set_mime_binary(), set_mime_error(), set_mime_html(), set_mime_not_modified(), and set_mime_text().

template<class T1 , class T2 , class C >
bool libdap::rops ( T1  a,
T2  b,
int  op 
) [inline]

This template function is used to compare two values of two instances of the DAP2 simple types (Byte, ..., Str). The function does not take the DAP2 objects as arguments; the caller must access the values of those objects and pass them to this function. The reason for this is that all the possible functions that could be generated from this template would have to be explicitly listed as friend functions in each of the DAP2 simple type classes. In the current implementation, only the simple type classes must be friends - to see why, look at Byte::ops and note that it accesses the _buf member of Int16, ..., Float64 and thus must be a friend of those classes.

NB: This would all be simpler if: 1) g++ supported template friend functions (without explicit listing of all the template's arguments). 2) we did not have unsigned types.

T1 The type of a.

T2 The type of b.

C A class which implements the policy used for comparing a and b.

Parameters:
a The first argument.
b The second argument.
op The relational operator.
See also:
Byte::ops

Definition at line 251 of file Operators.h.

Referenced by libdap::Byte::ops().

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

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

void libdap::save_str ( char *  dst,
const char *  src,
const int  line_num 
)

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 157 of file parser-util.cc.

References ID_MAX, long_to_string(), and parse_error().

Here is the call graph for this function:

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 that values, this method sets the read_p property for dest.

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 156 of file ce_functions.cc.

References dods_array_c, dods_byte_c, dods_float32_c, dods_float64_c, dods_int16_c, dods_int32_c, dods_str_c, dods_uint16_c, dods_uint32_c, dods_url_c, libdap::BaseType::is_simple_type(), libdap::Vector::length(), long_to_string(), libdap::Vector::set_read_p(), libdap::BaseType::type(), and libdap::Vector::var().

Referenced by libdap::GridGeoConstraint::apply_constraint_to_data().

Here is the call graph for this function:

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).

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 563 of file cgi_util.cc.

References CRLF, DAP_PROTOCOL_VERSION, DVR, rfc822_date(), and x_plain.

Here is the call graph for this function:

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).

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 518 of file cgi_util.cc.

References CRLF, DAP_PROTOCOL_VERSION, DVR, rfc822_date(), and x_plain.

Referenced by libdap::DODSFilter::send_blob(), and libdap::DODSFilter::send_data().

Here is the call graph for this function:

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.

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 629 of file cgi_util.cc.

References CRLF, DAP_PROTOCOL_VERSION, DVR, and rfc822_date().

Here is the call graph for this function:

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.

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 602 of file cgi_util.cc.

References CRLF, DAP_PROTOCOL_VERSION, DVR, and rfc822_date().

Here is the call graph for this function:

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.

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 469 of file cgi_util.cc.

References CRLF, DAP_PROTOCOL_VERSION, dods_error, DVR, rfc822_date(), and x_plain.

Here is the call graph for this function:

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.

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 423 of file cgi_util.cc.

References CRLF, DAP_PROTOCOL_VERSION, dods_error, DVR, rfc822_date(), and x_plain.

Here is the call graph for this function:

void libdap::set_mime_not_modified ( ostream &  strm  ) 

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.

Parameters:
strm Write the response to this stream.

Definition at line 672 of file cgi_util.cc.

References CRLF, and rfc822_date().

Here is the call graph for this function:

void libdap::set_mime_not_modified ( FILE *  out  ) 

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.

Parameters:
out Write the response to this FILE pointer.

Definition at line 657 of file cgi_util.cc.

References CRLF, and rfc822_date().

Referenced by libdap::DODSFilter::send_blob(), libdap::DODSFilter::send_das(), libdap::DODSFilter::send_data(), libdap::DODSFilter::send_dds(), and libdap::DODSFilter::send_ddx().

Here is the call graph for this function:

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.

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 372 of file cgi_util.cc.

References CRLF, dap4_ddx, DAP_PROTOCOL_VERSION, dods_error, DVR, rfc822_date(), and x_plain.

Here is the call graph for this function:

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.

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 319 of file cgi_util.cc.

References CRLF, dap4_ddx, DAP_PROTOCOL_VERSION, dods_error, DVR, rfc822_date(), and x_plain.

Referenced by libdap::DODSFilter::send_das(), libdap::DODSFilter::send_dds(), and libdap::DODSFilter::send_ddx().

Here is the call graph for this function:

bool libdap::size_ok ( uint  sz,
uint  nelem 
)

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 616 of file util.cc.

Referenced by build_btp_args().

AttrType libdap::String_to_AttrType ( const string &  s  ) 

Definition at line 76 of file AttrTable.cc.

References Attr_byte, Attr_container, Attr_float32, Attr_float64, Attr_int16, Attr_int32, Attr_string, Attr_uint16, Attr_uint32, Attr_unknown, Attr_url, and downcase().

Referenced by libdap::AttrTable::append_attr().

Here is the call graph for this function:

string libdap::systime (  ) 

Definition at line 362 of file util.cc.

FILE* libdap::text_to_temp ( string  text  ) 

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 352 of file escaping.cc.

References DBG, and unoctstring().

Here is the call graph for this function:

string libdap::unhexstring ( string  s  ) 

Definition at line 90 of file escaping.cc.

Referenced by www2id().

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

bool libdap::unit_or_name_match ( set< string >  units,
set< string >  names,
const string &  var_units,
const string &  var_name 
)

Look in the containers which hold the units attributes and variable name prefixes which are considered as identifying a vector as being a latitude or longitude vector.

Parameters:
units A container with a bunch of units attribute values.
names A container with a bunch of variable name prefixes.
var_units The value of the 'units' attribute for this variable.
var_name The name of the variable.
Returns:
True if the units_value matches any of the accepted attributes exactly or if the name_value starts with any of the accepted prefixes

Definition at line 86 of file GeoConstraint.cc.

string libdap::unoctstring ( string  s  ) 

Definition at line 112 of file escaping.cc.

References DBG.

Referenced by unescattr().

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. DODSFilter::initialize() The dataset name is decoded except that 20 is not removed.
  2. DODSFilter::set_ce() The CE is decoded, except for spaces (20).
  3. DODSFilter::set_dataset_name() same logic as the first case.

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 213 of file escaping.cc.

References unhexstring().

Referenced by libdap::AttrTable::add_container_alias(), libdap::AttrTable::add_value_alias(), libdap::AttrTable::append_attr(), libdap::AttrTable::append_container(), libdap::Array::append_dim(), libdap::AttrTable::del_attr(), libdap::DODSFilter::initialize(), libdap::DODSFilter::set_ce(), libdap::DODSFilter::set_dataset_name(), libdap::BaseType::set_name(), libdap::AttrTable::set_name(), libdap::Vector::var(), libdap::Structure::var(), libdap::Sequence::var(), libdap::Grid::var(), and libdap::DDS::var().

Here is the call graph for this function:

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 267 of file escaping.cc.


Variable Documentation

Definition at line 74 of file HTTPConnect.cc.

Referenced by main(), and libdap::HTTPResponse::~HTTPResponse().

const int libdap::DODS_MAX_ARRAY = DODS_INT_MAX

const string libdap::double_quote = "\""

Definition at line 924 of file AttrTable.cc.

const unsigned int libdap::max_str_len = DODS_USHRT_MAX - 1

const unsigned int libdap::max_url_len = 255

Definition at line 57 of file Url.h.

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 82 of file DODSFilter.cc.

Referenced by libdap::DODSFilter::print_usage().

Definition at line 71 of file HTTPConnect.cc.


Generated on Sun Jul 26 16:01:19 2009 for libdap++ by  doxygen 1.5.9