增加ACE安全测试工程

This commit is contained in:
2025-12-06 16:42:21 +08:00
parent b78ee53326
commit b38ad590a9
68 changed files with 5385 additions and 0 deletions
+25
View File
@@ -0,0 +1,25 @@
add_library(aGameProto
GameProto.proto
GameProto.h
GameProto.cpp
)
protobuf_generate(
LANGUAGE cpp
TARGET aGameProto
PROTOS GameProto.proto
)
target_include_directories(aGameProto
PUBLIC
${CMAKE_CURRENT_BINARY_DIR}
PRIVATE
${CYCLONE_DIR}/include
)
target_link_libraries(aGameProto
PUBLIC
protobuf::libprotobuf
)
+69
View File
@@ -0,0 +1,69 @@
#include "GameProto.h"
#include "GameProto.pb.h"
void serializeProtoMessage(uint16_t id, ::google::protobuf::Message* message, cyclone::Packet& outputPacket)
{
uint16_t messageSize = static_cast<uint16_t>(message->ByteSizeLong());
outputPacket.build_from_memory(GAME_PACKET_HEAD_SIZE, id, messageSize, nullptr);
message->SerializeToArray(outputPacket.get_packet_content(), messageSize);
}
::google::protobuf::Message* parserProtoMessage(const cyclone::Packet& inputPacket)
{
uint16_t packetID = inputPacket.get_packet_id();
::google::protobuf::Message* newMessage = nullptr;
switch (packetID)
{
case GAME_PROTO_LOGIN_REQUEST:
newMessage = new Game::LoginRequest();
break;
case GAME_PROTO_LOGIN_REPLY:
newMessage = new Game::LoginReply();
break;
case GAME_PROTO_CLIENT_PACKET:
newMessage = new Game::ClientTickPacket();
break;
case GAME_PROTO_SERVER_PACKET:
newMessage = new Game::ServerTickPacket();
break;
case GAME_PROTO_HEART_BEAT:
newMessage = new Game::HeartBeat();
break;
case GAME_PROTO_UGC_REQUEST:
newMessage = new Game::UGCRequest();
break;
case GAME_PROTO_UGC_REPLY:
newMessage = new Game::UGCReply();
break;
case GAME_PROTO_REPORT_REQ:
newMessage = new Game::GameReportReq();
break;
case GAME_PROTO_REPORT_RES:
newMessage = new Game::GameReportRes();
break;
case GAME_PROTO_NETBAR_REQ:
newMessage = new Game::NetbaraStatusReq();
break;
case GAME_PROTO_NETBAR_RES:
newMessage = new Game::NetbarStatusRes();
break;
default:
break;
}
if (newMessage)
{
newMessage->ParseFromArray(inputPacket.get_packet_content(), inputPacket.get_packet_size());
}
return newMessage;
}
+34
View File
@@ -0,0 +1,34 @@
#pragma once
#include <vector>
#include <cy_network.h>
namespace google {
namespace protobuf {
class Message;
}
};
enum
{
GAME_PACKET_HEAD_SIZE = 4
};
enum GameProto
{
GAME_PROTO_LOGIN_REQUEST = 1,
GAME_PROTO_LOGIN_REPLY = 2,
GAME_PROTO_CLIENT_PACKET = 3,
GAME_PROTO_SERVER_PACKET = 4,
GAME_PROTO_HEART_BEAT = 5,
GAME_PROTO_UGC_REQUEST = 6,
GAME_PROTO_UGC_REPLY = 7,
GAME_PROTO_REPORT_REQ = 8,
GAME_PROTO_REPORT_RES = 9,
GAME_PROTO_NETBAR_REQ = 10,
GAME_PROTO_NETBAR_RES = 11,
};
void serializeProtoMessage(uint16_t id, ::google::protobuf::Message* message, cyclone::Packet& outputPacket);
::google::protobuf::Message* parserProtoMessage(const cyclone::Packet& inputPacket);
+110
View File
@@ -0,0 +1,110 @@
syntax = "proto3";
package Game;
message LoginRequest
{
string accound_id = 1;
int32 world_id = 2;
int32 pb_retcode = 3;
};
message LightFeature
{
int32 data_len = 1;
int32 data_crc = 2;
bytes data = 3;
string name = 4;
}
message LoginReply
{
int32 result = 1;
int32 runtime_id = 2;
bytes ace_token = 3;
LightFeature light_feature = 4;
}
message HeartBeat
{
int32 timestamp = 1;
bytes pb_data = 2;
}
message ClientTickPacket
{
bytes client_packet = 1;
}
message ServerTickPacket
{
bytes server_packet = 1;
}
message UGCRequest
{
int32 ugc_ctx_id = 1;
int32 ugc_scene_id = 2;
string ugc_content = 3;
}
message UGCReply
{
int32 ugc_ctx_id = 1;
int32 error_code = 2;
int32 result = 3;
string filted_content = 4;
}
message GameReportReq
{
//.被举报者信息
string reported_account_id =1; //被举报者账号ID
int32 reported_world_id=2; //被举报者小区号
string reported_name = 3; //被举报者小区号
string reported_roleid = 4; //被举报者角色号1
int32 ctx_id =5; //用子标识消息的唯ID
//举报数据
int32 report_category = 10; //举报的大类
repeated int32 report_reason = 11; //举报原因类型
int32 report_scene=12; //举报场景
string reported_profile_url=13;//被举报者的头像URL
string report_battle_id =14; //对局ID
int32 report_battle_time=15; //对局时间点
string report_desc =16; //举报详细描述
string report_content = 17; //举报的文本内容
repeated string pic_url_array=18; //举报的图片URL列表
repeated string video_url_array =19; //举报的视频URL列表
repeated string voice_url_array=20; //举报的语音URL列表
string report_group_id=21; //被举报的公会、战队、房间等组织ID
string report_group_name=22; //被举报的公会、战队、房间等组织名称
repeated GameReportContentID content_id_array = 23;
int32 report_entrance=24; //举报入口标识
}
message GameReportContentID
{
string id_type=1;
repeated string id_list=2;
}
message GameReportRes
{
int32 ctx_id =1; //用子标识消息的唯ID
int32 result =2; //服务器返回的代码,0表示成功,非0表示失败
string err_msg=3; //错误描述信息
}
message NetbaraStatusReq
{
bool is_netbar_machine=1;
string token=2;
string macs=3;
}
message NetbarStatusRes
{
int32 error_code=1;
string error_message=2;
int32 netbar_level=3;
}