An open and free bittorrent tracker https://erdgeist.org/gitweb/opentracker
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

56 lines
1.7 KiB

  1. /* This software was written by Dirk Engling <erdgeist@erdgeist.org>
  2. It is considered beerware. Prost. Skol. Cheers or whatever.
  3. $id$ */
  4. #ifndef SCAN_URLENCODED_QUERY_H__
  5. #define SCAN_URLENCODED_QUERY_H__
  6. #include <sys/types.h>
  7. typedef struct {
  8. char *key;
  9. int value;
  10. } ot_keywords;
  11. typedef enum {
  12. SCAN_PATH = 1,
  13. SCAN_SEARCHPATH_PARAM = 2,
  14. SCAN_SEARCHPATH_VALUE = 4,
  15. SCAN_SEARCHPATH_TERMINATOR = 8
  16. } SCAN_SEARCHPATH_FLAG;
  17. /* string in: pointer to source
  18. out: pointer to next scan position
  19. deststring pointer to destination
  20. flags determines, what to parse
  21. returns number of valid converted characters in deststring
  22. or -1 for parse error
  23. or -2 for terminator found
  24. */
  25. ssize_t scan_urlencoded_query(char **string, char *deststring, SCAN_SEARCHPATH_FLAG flags);
  26. /* string in: pointer to source
  27. out: pointer to next scan position
  28. flags determines, what to parse
  29. returns value for matched keyword
  30. or -1 for parse error
  31. or -2 for terminator found
  32. or -3 for no keyword matched
  33. */
  34. int scan_find_keywords( const ot_keywords * keywords, char **string, SCAN_SEARCHPATH_FLAG flags);
  35. /* string in: pointer to value of a param=value pair to skip
  36. out: pointer to next scan position on return
  37. */
  38. void scan_urlencoded_skipvalue( char **string );
  39. /* data pointer to len chars of string
  40. len length of chars in data to parse
  41. number number to receive result
  42. returns number of bytes not parsed, mostly !=0 means fail
  43. */
  44. ssize_t scan_fixed_int( char *data, size_t len, int *number );
  45. #endif