ocuri.h 1.7 KB

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