Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Packet 0x17 support #26

Merged
merged 4 commits into from
Jun 17, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/bnetd/handle_bnet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ namespace pvpgn
static int _client_adack(t_connection * c, t_packet const *const packet);
static int _client_adclick(t_connection * c, t_packet const *const packet);
static int _client_adclick2(t_connection * c, t_packet const *const packet);
static int _client_readmemory(t_connection * c, t_packet const *const packet);
static int _client_statsupdate(t_connection * c, t_packet const *const packet);
static int _client_playerinforeq(t_connection * c, t_packet const *const packet);
static int _client_progident2(t_connection * c, t_packet const *const packet);
Expand Down Expand Up @@ -236,6 +237,7 @@ namespace pvpgn
{ CLIENT_ADACK, _client_adack },
{ CLIENT_ADCLICK, _client_adclick },
{ CLIENT_ADCLICK2, _client_adclick2 },
{ CLIENT_READMEMORY, _client_readmemory },
{ CLIENT_STATSREQ, _client_statsreq },
{ CLIENT_STATSUPDATE, _client_statsupdate },
{ CLIENT_PLAYERINFOREQ, _client_playerinforeq },
Expand Down Expand Up @@ -3293,6 +3295,18 @@ namespace pvpgn

return 0;
}

static int _client_readmemory(t_connection * c, t_packet const *const packet)
{
if (packet_get_size(packet) < sizeof(t_client_readmemory)) {
eventlog(eventlog_level_error, __FUNCTION__, "[%d] got bad READMEMORY packet (expected %lu bytes, got %u)", conn_get_socket(c), sizeof(t_client_readmemory), packet_get_size(packet));
return -1;
}

eventlog(eventlog_level_debug, __FUNCTION__, "[%d] Received READMEMORY packet with Request ID: %d and Memory: %d", conn_get_socket(c), bn_int_get(packet->u.client_readmemory.request_id), bn_int_get(packet->u.client_readmemory.memory));

return 0;
}

static int _client_statsupdate(t_connection * c, t_packet const *const packet)
{
Expand Down
17 changes: 13 additions & 4 deletions src/common/bnet_protocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -3270,13 +3270,22 @@ namespace pvpgn

/******************************************************/
/* seen in SC107a */
#define CLIENT_UNKNOWN_17 0x17ff
#define CLIENT_READMEMORY 0x17ff
typedef struct
{
t_bnet_header h;
/* FIXME: what is in here... is there a cooresponding
server packet? */
} PACKED_ATTR() t_client_unknown_17;
bn_int request_id;
bn_byte memory;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Type is actually VOID, I only tested 1 address and found that byte was the correct type, at least for the address that I tested

} PACKED_ATTR() t_client_readmemory;

#define SERVER_READMEMORY 0x17ff
typedef struct
{
t_bnet_header h;
bn_int request_id;
bn_int address;
bn_int length;
} PACKED_ATTR() t_server_readmemory;
/******************************************************/


Expand Down
6 changes: 4 additions & 2 deletions src/common/packet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -431,8 +431,8 @@ namespace pvpgn
return "CLIENT_ADCLICK";
case CLIENT_ADCLICK2:
return "CLIENT_ADCLICK2";
case CLIENT_UNKNOWN_17:
return "CLIENT_UNKNOWN_17";
case CLIENT_READMEMORY:
return "CLIENT_READMEMORY";
case CLIENT_UNKNOWN_24:
return "CLIENT_UNKNOWN_24";
case CLIENT_LADDERREQ:
Expand Down Expand Up @@ -684,6 +684,8 @@ namespace pvpgn
return "SERVER_ADREPLY";
case SERVER_ADCLICKREPLY2:
return "SERVER_ADCLICKREPLY2";
case SERVER_READMEMORY:
return "SERVER_READMEMORY";
case SERVER_LADDERREPLY:
return "SERVER_LADDERREPLY";
case SERVER_ECHOREQ:
Expand Down
2 changes: 2 additions & 0 deletions src/common/packet.h
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,8 @@ namespace pvpgn
t_client_adclick client_adclick;
t_client_adclick2 client_adclick2;
t_server_adclickreply2 server_adclickreply2;
t_client_readmemory client_readmemory;
t_server_readmemory server_readmemory;
t_client_game_report client_gamerep;
t_server_sessionkey1 server_sessionkey1;
t_server_sessionkey2 server_sessionkey2;
Expand Down