[409] | 1 | /* Copyright 2009, UCAR/Unidata and OPeNDAP, Inc. |
---|
| 2 | See the COPYRIGHT file for more information. */ |
---|
| 3 | |
---|
| 4 | #ifndef OCURI_H |
---|
| 5 | #define OCURI_H |
---|
| 6 | |
---|
| 7 | /*! This is an open structure meaning |
---|
| 8 | it is ok to directly access its fields*/ |
---|
| 9 | typedef struct OCURI { |
---|
| 10 | char* uri; /* as passed by the caller */ |
---|
| 11 | char* protocol; |
---|
| 12 | char* user; /* from user:password@ */ |
---|
| 13 | char* password; /* from user:password@ */ |
---|
| 14 | char* host; /*!< host*/ |
---|
| 15 | char* port; /*!< host */ |
---|
| 16 | char* file; /*!< file */ |
---|
| 17 | char* constraint; /*!< projection+selection */ |
---|
| 18 | char* projection; /*!< without leading '?'*/ |
---|
| 19 | char* selection; /*!< with leading '&'*/ |
---|
| 20 | char* params; /* all params */ |
---|
| 21 | char** paramlist; /*!<null terminated list */ |
---|
| 22 | } OCURI; |
---|
| 23 | |
---|
| 24 | extern int ocuriparse(const char* s, OCURI** ocuri); |
---|
| 25 | extern void ocurifree(OCURI* ocuri); |
---|
| 26 | |
---|
| 27 | /* Replace the constraints */ |
---|
| 28 | extern void ocurisetconstraints(OCURI*,const char* constraints); |
---|
| 29 | |
---|
| 30 | /* Construct a complete OC URI; caller frees returned string */ |
---|
| 31 | |
---|
| 32 | /* Define flags to control what is included */ |
---|
| 33 | #define OCURICONSTRAINTS 1 |
---|
| 34 | #define OCURIUSERPWD 2 |
---|
| 35 | #define OCURIPARAMS 4 |
---|
| 36 | #define OCURIENCODE 8 /* If output should be encoded */ |
---|
| 37 | |
---|
| 38 | extern char* ocuribuild(OCURI*,const char* prefix, const char* suffix, int flags); |
---|
| 39 | |
---|
| 40 | /* Param Management */ |
---|
| 41 | extern int ocuridecodeparams(OCURI* ocuri); |
---|
| 42 | extern int ocurisetparams(OCURI* ocuri,const char*); |
---|
| 43 | |
---|
| 44 | /*! NULL result => entry not found. |
---|
| 45 | Empty value should be represented as a zero length string */ |
---|
| 46 | extern const char* ocurilookup(OCURI*, const char* param); |
---|
| 47 | |
---|
| 48 | extern char* ocuriencode(char* s, char* allowable); |
---|
| 49 | extern char* ocuridecode(char* s); |
---|
| 50 | extern char* ocuridecodeonly(char* s, char*); |
---|
| 51 | |
---|
| 52 | #endif /*OCURI_H*/ |
---|