9ceb218f80
Co-authored-by: Cursor <cursoragent@cursor.com>
41 lines
1.2 KiB
C
41 lines
1.2 KiB
C
#ifndef _BS_WEBSOCKET_H_
|
||
#define _BS_WEBSOCKET_H_
|
||
|
||
#include "publicdata/type.h"
|
||
#include "publicdata/public_define.h"
|
||
#include <string.h>
|
||
#include <stdio.h>
|
||
|
||
|
||
#if BS_OCPP_EN //OCPP平台使能
|
||
|
||
#define OCPP_WEBSOCKET_EN 1
|
||
/** WebSocket HTTP 握手是否携带 Authorization: Basic(桩号:密钥);0=不携带,适用于不要求 HTTP Basic 的平台 */
|
||
#ifndef OCPP_WS_HTTP_AUTHORIZATION_EN
|
||
#define OCPP_WS_HTTP_AUTHORIZATION_EN 1
|
||
#endif
|
||
/** GET 路径是否在桩号后加尾斜杠;PLN 等为 /wsspkludev/CPID(默认 0,桩号后无 /) */
|
||
#ifndef OCPP_WS_GET_PATH_TRAILING_SLASH
|
||
#define OCPP_WS_GET_PATH_TRAILING_SLASH 0
|
||
#endif
|
||
typedef enum
|
||
{
|
||
WDT_NULL = 0, // 非标准数据包
|
||
WDT_MINDATA, // 0x0:中间数据包
|
||
WDT_TXTDATA, // 0x1:txt类型数据包
|
||
WDT_BINDATA, // 0x2:bin类型数据包
|
||
WDT_DISCONN, // 0x8:断开连接类型数据包 收到后需手动 close(fd)
|
||
WDT_PING, // 0x8:ping类型数据包 ws_recv 函数内自动回复pong
|
||
WDT_PONG, // 0xA:pong类型数据包
|
||
} Ws_DataType;
|
||
|
||
int websocket_build();
|
||
void ocpp_recv();
|
||
|
||
int ws_send(void* buff, int buffLen, bool mask, Ws_DataType type);
|
||
|
||
#endif
|
||
|
||
|
||
#endif
|