yuarel.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /*
  2. * yuarel.h
  3. *
  4. * Created on: 2022/12/9
  5. * Author: folus
  6. */
  7. #ifndef YUAREL_H_
  8. #define YUAREL_H_
  9. #include <sys/types.h>
  10. #include <sys/stat.h>
  11. #include <sys/time.h>
  12. #include <sys/timeb.h>
  13. #include <sys/types.h>
  14. #include <sys/ioctl.h>
  15. #include <sys/socket.h>
  16. #include <sys/ipc.h>
  17. #include <sys/shm.h>
  18. #include <sys/mman.h>
  19. #include <linux/wireless.h>
  20. #include <arpa/inet.h>
  21. #include <netinet/in.h>
  22. #include <dirent.h>
  23. #include <unistd.h>
  24. #include <stdarg.h>
  25. #include <stdio.h>
  26. #include <stdlib.h>
  27. #include <unistd.h>
  28. #include <fcntl.h>
  29. #include <termios.h>
  30. #include <errno.h>
  31. #include <errno.h>
  32. #include <string.h>
  33. #include <time.h>
  34. #include <ctype.h>
  35. #include <ifaddrs.h>
  36. #include <stdbool.h>
  37. #include <stddef.h>
  38. #include <stdint.h>
  39. struct yuarel {
  40. char *scheme; /* scheme, without ":" and "//" */
  41. char *username; /* username, default: NULL */
  42. char *password; /* password, default: NULL */
  43. char *host; /* hostname or IP address */
  44. int port; /* port, default: 0 */
  45. char *path; /* path, without leading "/", default: NULL */
  46. char *query; /* query, default: NULL */
  47. char *fragment; /* fragment, default: NULL */
  48. };
  49. /* A struct to hold the query string parameter values. */
  50. struct yuarel_param {
  51. char *key;
  52. char *val;
  53. };
  54. extern int yuarel_parse(struct yuarel *url, char *url_str);
  55. extern int yuarel_split_path(char *path, char **parts, int max_parts);
  56. extern int yuarel_parse_query(char *query, char delimiter, struct yuarel_param *params, int max_params);
  57. #endif /* YUAREL_H_ */