1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- #ifndef BIZCHAN_H
- #define BIZCHAN_H
- #pragma once
- #include <crtdbg.h>
- #include <stdarg.h>
- #ifdef __cplusplus
- extern "C" {
- #endif
- #ifdef LIBBIZCHAN_EXPORTS
- #define BIZCHAN_API(type) _declspec(dllexport) type __stdcall
- #else
- #define BIZCHAN_API(type) _declspec(dllimport) type __stdcall
- #endif
- typedef struct bizchan_t bizchan_t;
- typedef struct bizchan_config_t {
- char *proxy_server;
- int proxy_server_port;
- char *bak_proxy_server;
- int bak_proxy_server_port;
- union {
- char *agent_id;
- char *call_no;
- };
- char *client_id;
- char *session_id;
- struct {
- int rtp_port;
- int desc;
- }video;
- }bizchan_config_t;
- typedef struct bizchan_callback_t {
- void (*on_recv_photo)(bizchan_t *chan, int id, int error, int width, int height, const char *rgb24, int size, void *user_data);
- void (*on_recv_screen)(bizchan_t *chan, int id, int error, int width, int height, const char *rgb24, int size, void *user_data);
- void (*on_recv_pkt)(bizchan_t *chan, int type, int sub_type, int id, const char *pkt, int pkt_size, void *user_data);
- void (*on_connect)(bizchan_t *chan, int error, const char *remote_ip, int remote_video_rtp, int remote_video_desc, const char *remote_client_id, void *user_data);
- void (*on_close)(bizchan_t *chan, void *user_data);
- void (*on_destroy)(bizchan_t *chan, void *user_data);
- void (*dbg)(void *user_data, const char* fmt, va_list arg);
- void *user_data;
- }bizchan_callback_t;
- BIZCHAN_API(int) bizchan_lib_init();
- BIZCHAN_API(int) bizchan_lib_term();
- BIZCHAN_API(int) bizchan_create(const bizchan_config_t *config, const bizchan_callback_t *cb, bizchan_t **p_chan);
- BIZCHAN_API(void) bizchan_destroy(bizchan_t *chan);
- BIZCHAN_API(void) bizchan_set_tag(bizchan_t *chan, void *tag);
- BIZCHAN_API(void*) bizchan_get_tag(bizchan_t *chan);
- BIZCHAN_API(int) bizchan_start_connect(bizchan_t *chan);
- BIZCHAN_API(int) bizchan_start_close(bizchan_t *chan);
- BIZCHAN_API(int) bizchan_close(bizchan_t *chan);
- BIZCHAN_API(int) bizchan_post_pkt(bizchan_t *chan, int type, int compress, int encrypt, int sub_type, int id, const char *pkt, int pkt_size);
- typedef void (*OnRecvPacket)(int sub_type, const void *buf, int size, void *user_data);
- typedef void (*OnMode)(int writeable, void *user_data);
- BIZCHAN_API(int) bizchan_winsync_send(bizchan_t *chan, int sub_type, const void *buf, int size);
- BIZCHAN_API(int) bizchan_winsync_set_cb(bizchan_t *chan, OnRecvPacket pkt_cb, OnMode mode_cb, void *user_data);
- #ifdef __cplusplus
- } // extern "C" {
- #endif
- #endif // BIZCHAN_H
|