http.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. HTTPRES_OK, /* result OK */
  27. HTTPRES_OK_NOT_MODIFIED, /* not modified since last request */
  28. HTTPRES_NOT_FOUND, /* not found */
  29. HTTPRES_BAD_REQUEST, /* client error */
  30. HTTPRES_SERVER_ERROR, /* server reported an error */
  31. HTTPRES_REDIRECTED, /* resource has been moved */
  32. HTTPRES_LOST_CONNECTION /* connection lost while waiting for data */
  33. } HTTPResult;
  34. struct HTTP_ctx {
  35. char *date;
  36. int size;
  37. int status;
  38. void *data;
  39. };
  40. typedef size_t (HTTP_read_callback)(void *ptr, size_t size, size_t nmemb, void *stream);
  41. HTTPResult HTTP_get(struct HTTP_ctx *http, const char *url, HTTP_read_callback *cb);
  42. #endif