http.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #ifndef __RTMP_HTTP_H__
  2. #define __RTMP_HTTP_H__
  3. /*
  4. * Copyright (C) 2010 Howard Chu
  5. * Copyright (C) 2010 Antti Ajanki
  6. *
  7. * This file is part of librtmp.
  8. *
  9. * librtmp is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU Lesser General Public License as
  11. * published by the Free Software Foundation; either version 2.1,
  12. * or (at your option) any later version.
  13. *
  14. * librtmp is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Lesser General Public License
  20. * along with librtmp see the file COPYING. If not, write to
  21. * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  22. * Boston, MA 02110-1301, USA.
  23. * http://www.gnu.org/copyleft/lgpl.html
  24. */
  25. typedef enum
  26. {
  27. HTTPRES_OK, /* result OK */
  28. HTTPRES_OK_NOT_MODIFIED, /* not modified since last request */
  29. HTTPRES_NOT_FOUND, /* not found */
  30. HTTPRES_BAD_REQUEST, /* client error */
  31. HTTPRES_SERVER_ERROR, /* server reported an error */
  32. HTTPRES_REDIRECTED, /* resource has been moved */
  33. HTTPRES_LOST_CONNECTION /* connection lost while waiting for data */
  34. } HTTPResult;
  35. struct HTTP_ctx
  36. {
  37. char *date;
  38. int size;
  39. int status;
  40. void *data;
  41. };
  42. typedef size_t (HTTP_read_callback)(void *ptr, size_t size, size_t nmemb, void *stream);
  43. HTTPResult HTTP_get(struct HTTP_ctx *http, const char *url, HTTP_read_callback *cb);
  44. #endif