代码拉取完成,页面将自动刷新
/* vim: set et ts=4 sts=4 sw=4 : */
/********************************************************************\
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
* published by the Free Software Foundation; either version 2 of *
* the License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License*
* along with this program; if not, contact: *
* *
* Free Software Foundation Voice: +1-617-542-5942 *
* 59 Temple Place - Suite 330 Fax: +1-617-542-2652 *
* Boston, MA 02111-1307, USA gnu@gnu.org *
* *
\********************************************************************/
/** @file msg.h
@brief xfrpc msg struct
@author Copyright (C) 2016 Dengfeng Liu <liu_df@qq.com>
*/
#ifndef _MSG_H_
#define _MSG_H_
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include <inttypes.h>
#include "client.h"
#include "common.h"
#define TYPE_LEN 1 //byte, char
#define MSG_TYPE_I 0
#define MSG_LEN_I 1
#define MSG_DATA_I 9
// msg_type match frp v0.10.0
enum msg_type {
TypeLogin = 'o',
TypeLoginResp = '1',
TypeNewProxy = 'p',
TypeNewProxyResp = '2',
TypeCloseProxy = 'c',
TypeNewWorkConn = 'w',
TypeReqWorkConn = 'r',
TypeStartWorkConn = 's',
TypeNewVisitorConn = 'v',
TypeNewVisitorConnResp = '3',
TypePing = 'h',
TypePong = '4',
TypeUDPPacket = 'u',
TypeNatHoleVisitor = 'i',
TypeNatHoleClient = 'n',
TypeNatHoleResp = 'm',
TypeNatHoleClientDetectOK = 'd',
TypeNatHoleSid = '5',
};
struct general_response {
int code;
char *msg;
};
struct control_response {
int type;
int code;
char *msg;
};
struct new_proxy_response {
char *run_id;
char *proxy_name;
char *error;
int remote_port;
};
struct work_conn {
char *run_id;
};
struct udp_addr {
char *addr;
int port;
char *zone;
};
struct udp_packet {
char *content; // base64
struct udp_addr *laddr;
struct udp_addr *raddr;
};
struct __attribute__((__packed__)) msg_hdr {
char type;
uint64_t length;
uint8_t data[];
};
struct start_work_conn_resp {
char *proxy_name;
};
int new_udp_packet_marshal(const struct udp_packet *udp, char **msg);
int new_proxy_service_marshal(const struct proxy_service *np_req, char **msg);
char *calc_md5(const char *data, int datalen);
char *get_auth_key(const char *token, long int *timestamp);
size_t login_request_marshal(char **msg);
// tranlate control request to json string
struct new_proxy_response *new_proxy_resp_unmarshal(const char *jres);
struct login_resp *login_resp_unmarshal(const char *jres);
struct start_work_conn_resp *start_work_conn_resp_unmarshal(const char *resp_msg);
// parse json string to control response
struct control_response *control_response_unmarshal(const char *jres);
struct work_conn *new_work_conn();
int new_work_conn_marshal(const struct work_conn *work_c, char **msg);
// parse json string to udp packet
struct udp_packet *udp_packet_unmarshal(const char *jres);
void udp_packet_free(struct udp_packet *udp);
void control_response_free(struct control_response *res);
#endif //_MSG_H_
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。