http.h 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. #ifndef __HTTP_H__
  2. #define __HTTP_H__
  3. #include <rtthread.h>
  4. struct http_session
  5. {
  6. char* user_agent;
  7. int socket;
  8. /* size of http file */
  9. rt_size_t size;
  10. rt_off_t position;
  11. };
  12. struct shoutcast_session
  13. {
  14. int socket;
  15. /* shoutcast name and bitrate */
  16. char* station_name;
  17. int bitrate;
  18. /* size of meta data */
  19. rt_size_t metaint;
  20. rt_size_t current_meta_chunk;
  21. };
  22. struct http_session* http_session_open(char* url);
  23. rt_size_t http_session_read(struct http_session* session, rt_uint8_t *buffer, rt_size_t length);
  24. rt_off_t http_session_seek(struct http_session* session, rt_off_t offset, int mode);
  25. int http_session_close(struct http_session* session);
  26. struct shoutcast_session* shoutcast_session_open(char* url);
  27. rt_size_t shoutcast_session_read(struct shoutcast_session* session, rt_uint8_t *buffer, rt_size_t length);
  28. rt_off_t shoutcast_session_seek(struct shoutcast_session* session, rt_off_t offset, int mode);
  29. int shoutcast_session_close(struct shoutcast_session* session);
  30. #endif