tbfcp_session.h 3.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /* Copyright (C) 2014 Mamadou DIOP.
  2. *
  3. * This file is part of Open Source Doubango Framework.
  4. *
  5. * DOUBANGO is free software: you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation, either version 3 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * DOUBANGO is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU Lesser General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with DOUBANGO.
  17. *
  18. */
  19. #ifndef TBFCP_SESSION_H
  20. #define TBFCP_SESSION_H
  21. #include "tinybfcp_config.h"
  22. #include "tinybfcp/tbfcp_types.h"
  23. #include "tinynet.h"
  24. TBFCP_BEGIN_DECLS
  25. struct tbfcp_session_s;
  26. struct tbfcp_pkt_s;
  27. typedef enum tbfcp_session_event_type_e {
  28. tbfcp_session_event_type_inf_inc_msg,
  29. tbfcp_session_event_type_err_send_timedout
  30. }
  31. tbfcp_session_event_type_t;
  32. typedef struct tbfcp_session_event_xs {
  33. enum tbfcp_session_event_type_e e_type;
  34. const struct tbfcp_pkt_s* pc_pkt;
  35. const void* pc_usr_data;
  36. } tbfcp_session_event_xt;
  37. typedef int (*tbfcp_session_callback_f)(const struct tbfcp_session_event_xs *e);
  38. TINYBFCP_API int tbfcp_session_create(enum tnet_socket_type_e e_socket_type, const char* pc_local_ip, struct tbfcp_session_s** pp_self);
  39. TINYBFCP_API int tbfcp_session_create_2(struct tnet_ice_ctx_s* p_ice_ctx, struct tbfcp_session_s** pp_self);
  40. TINYBFCP_API int tbfcp_session_set_callback(struct tbfcp_session_s* p_self, tbfcp_session_callback_f f_fun, const void* pc_usr_data);
  41. TINYBFCP_API int tbfcp_session_set_ice_ctx(struct tbfcp_session_s* p_self, struct tnet_ice_ctx_s* p_ice_ctx);
  42. TINYBFCP_API int tbfcp_session_prepare(struct tbfcp_session_s* p_self);
  43. TINYBFCP_API int tbfcp_session_start(struct tbfcp_session_s* p_self);
  44. TINYBFCP_API int tbfcp_session_pause(struct tbfcp_session_s* p_self);
  45. TINYBFCP_API int tbfcp_session_stop(struct tbfcp_session_s* p_self);
  46. TINYBFCP_API int tbfcp_session_set_natt_ctx(struct tbfcp_session_s* p_self, struct tnet_nat_ctx_s* p_natt_ctx);
  47. TINYBFCP_API int tbfcp_session_set_remote_address(struct tbfcp_session_s* p_self, const char* pc_ip, tnet_port_t u_port);
  48. TINYBFCP_API int tbfcp_session_set_remote_role(struct tbfcp_session_s* p_self, enum tbfcp_role_e e_role_remote);
  49. TINYBFCP_API int tbfcp_session_set_remote_setup(struct tbfcp_session_s* p_self, enum tbfcp_setup_e e_setup_remote);
  50. TINYBFCP_API int tbfcp_session_set_conf_ids(struct tbfcp_session_s* p_self, uint32_t u_conf_id, uint16_t u_user_id, uint16_t u_floor_id);
  51. TINYBFCP_API int tbfcp_session_get_profile(const struct tbfcp_session_s* pc_self, const char** ppc_profile);
  52. TINYBFCP_API int tbfcp_session_get_local_role(const struct tbfcp_session_s* pc_self, enum tbfcp_role_e *pe_role_local);
  53. TINYBFCP_API int tbfcp_session_get_local_setup(const struct tbfcp_session_s* pc_self, enum tbfcp_setup_e *pe_setup_local);
  54. TINYBFCP_API int tbfcp_session_get_local_address(const struct tbfcp_session_s* pc_self, const char** ppc_ip, tnet_port_t *pu_port);
  55. TINYBFCP_API int tbfcp_session_create_pkt_Hello(struct tbfcp_session_s* p_self, struct tbfcp_pkt_s** pp_pkt);
  56. TINYBFCP_API int tbfcp_session_create_pkt_FloorRequest(struct tbfcp_session_s* p_self, struct tbfcp_pkt_s** pp_pkt);
  57. TINYBFCP_API int tbfcp_session_create_pkt_FloorRelease(struct tbfcp_session_s* p_self, struct tbfcp_pkt_s** pp_pkt);
  58. TINYBFCP_API int tbfcp_session_send_pkt(struct tbfcp_session_s* p_self, const struct tbfcp_pkt_s* pc_pkt);
  59. TBFCP_END_DECLS
  60. #endif /* TBFCP_SESSION_H */