Ai
1 Star 0 Fork 0

zip/rtpengine

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
websocket.h 1.72 KB
一键复制 编辑 原始数据 按行查看 历史
Richard Fuchs 提交于 2020-08-19 03:33 +08:00 . TT#89352 support Janus control protocol
#ifndef __WEBSOCKET_H__
#define __WEBSOCKET_H__
#include <stdbool.h>
#include "str.h"
struct websocket_conn;
struct websocket_message;
enum lws_write_protocol;
struct janus_session;
typedef const char *(*websocket_message_func_t)(struct websocket_message *);
struct websocket_message {
struct websocket_conn *wc;
char *uri;
enum {
M_UNKNOWN = 0,
M_WEBSOCKET,
M_GET,
M_POST,
} method;
enum {
CT_UNKNOWN = 0,
CT_JSON,
CT_NG,
} content_type;
GString *body;
websocket_message_func_t func;
};
int websocket_init(void);
void websocket_start(void);
// appends to output buffer without triggering a response
void websocket_queue_raw(struct websocket_conn *wc, const char *msg, size_t len);
// adds data to output buffer (can be null) and optionally triggers specified response
int websocket_write_raw(struct websocket_conn *wc, const char *msg, size_t len,
enum lws_write_protocol protocol, bool done);
// adds data to output buffer (can be null) and triggers specified response: http or binary websocket
int websocket_write_http_len(struct websocket_conn *wc, const char *msg, size_t len, bool done);
int websocket_write_http(struct websocket_conn *wc, const char *msg, bool done);
int websocket_write_text(struct websocket_conn *wc, const char *msg, bool done);
int websocket_write_binary(struct websocket_conn *wc, const char *msg, size_t len, bool done);
// num bytes in output buffer
size_t websocket_queue_len(struct websocket_conn *wc);
// write HTTP response headers
int websocket_http_response(struct websocket_conn *wc, int status, const char *content_type,
ssize_t content_length);
// mark a janus session as owned by this transport
void websocket_conn_add_session(struct websocket_conn *, struct janus_session *);
#endif
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/zip/rtpengine.git
git@gitee.com:zip/rtpengine.git
zip
rtpengine
rtpengine
master

搜索帮助