thttp_challenge.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /*
  2. * Copyright (C) 2010-2015 Mamadou DIOP.
  3. *
  4. * This file is part of Open Source Doubango Framework.
  5. *
  6. * DOUBANGO is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation, either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * DOUBANGO is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with DOUBANGO.
  18. *
  19. */
  20. /**@file thttp_challenge.h
  21. * @brief HTTP authentication challenge.
  22. *
  23. */
  24. #ifndef TINYHTTP_AUTHENTICATION_CHALLENGE_H
  25. #define TINYHTTP_AUTHENTICATION_CHALLENGE_H
  26. #include "tinyhttp_config.h"
  27. #include "tinyhttp/thttp_message.h"
  28. #include "tinyhttp/headers/thttp_header.h"
  29. #include "tinyhttp/auth/thttp_auth.h"
  30. #include "tsk_object.h"
  31. #include "tsk_buffer.h"
  32. #include "tsk_list.h"
  33. #include "tsk_md5.h"
  34. THTTP_BEGIN_DECLS
  35. typedef struct thttp_challenge_s {
  36. TSK_DECLARE_OBJECT;
  37. tsk_bool_t isproxy;
  38. char* scheme;
  39. char* realm;
  40. char* nonce;
  41. char* opaque;
  42. char* algorithm;
  43. const char* qop;
  44. tsk_md5string_t cnonce;
  45. unsigned nc;
  46. }
  47. thttp_challenge_t;
  48. typedef tsk_list_t thttp_challenges_L_t;
  49. int thttp_challenge_update(thttp_challenge_t *self, const char* scheme, const char* realm, const char* nonce, const char* opaque, const char* algorithm, const char* qop);
  50. thttp_header_t *thttp_challenge_create_header_authorization(thttp_challenge_t *self, const char* username, const char* password, const thttp_request_t *request);
  51. thttp_header_t *thttp_challenge_create_header_authorization_2(thttp_challenge_t *self, const char* username, const char* password, const char* method, const char *uristring, const tsk_buffer_t* entity_body);
  52. thttp_challenge_t* thttp_challenge_create(tsk_bool_t isproxy,const char* scheme, const char* realm, const char* nonce, const char* opaque, const char* algorithm, const char* qop);
  53. thttp_challenge_t* thttp_challenge_dup(const thttp_challenge_t* self);
  54. TINYHTTP_GEXTERN const tsk_object_def_t *thttp_challenge_def_t;
  55. THTTP_END_DECLS
  56. #endif /* TINYHTTP_AUTHENTICATION_CHALLENGE_H */