-
Notifications
You must be signed in to change notification settings - Fork 0
/
packets.h
105 lines (90 loc) · 2.53 KB
/
packets.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
/*
* This file is part of PRO ONLINE.
* PRO ONLINE 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 3 of the License, or
* (at your option) any later version.
* PRO ONLINE 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 PRO ONLINE. If not, see <http://www.gnu.org/licenses/ .
*/
#ifndef _PACKETS_H_
#define _PACKETS_H_
#define OPCODE_PING 0
#define OPCODE_LOGIN 1
#define OPCODE_CONNECT 2
#define OPCODE_DISCONNECT 3
#define OPCODE_SCAN 4
#define OPCODE_SCAN_COMPLETE 5
#define OPCODE_CONNECT_BSSID 6
#define OPCODE_CHAT 7
// PSP Product Code
#define PRODUCT_CODE_LENGTH 9
typedef struct
{
// Game Product Code (ex. ULUS12345)
char data[PRODUCT_CODE_LENGTH];
} __attribute__((packed)) SceNetAdhocctlProductCode;
// Basic Packet
typedef struct
{
uint8_t opcode;
} __attribute__((packed)) SceNetAdhocctlPacketBase;
// C2S Login Packet
typedef struct
{
SceNetAdhocctlPacketBase base;
SceNetEtherAddr mac;
SceNetAdhocctlNickname name;
SceNetAdhocctlProductCode game;
} __attribute__((packed)) SceNetAdhocctlLoginPacketC2S;
// C2S Connect Packet
typedef struct
{
SceNetAdhocctlPacketBase base;
SceNetAdhocctlGroupName group;
} __attribute__((packed)) SceNetAdhocctlConnectPacketC2S;
// C2S Chat Packet
typedef struct
{
SceNetAdhocctlPacketBase base;
char message[64];
} __attribute__((packed)) SceNetAdhocctlChatPacketC2S;
// S2C Connect Packet
typedef struct
{
SceNetAdhocctlPacketBase base;
SceNetAdhocctlNickname name;
SceNetEtherAddr mac;
uint32_t ip;
} __attribute__((packed)) SceNetAdhocctlConnectPacketS2C;
// S2C Disconnect Packet
typedef struct
{
SceNetAdhocctlPacketBase base;
uint32_t ip;
} __attribute__((packed)) SceNetAdhocctlDisconnectPacketS2C;
// S2C Scan Packet
typedef struct
{
SceNetAdhocctlPacketBase base;
SceNetAdhocctlGroupName group;
SceNetEtherAddr mac;
} __attribute__((packed)) SceNetAdhocctlScanPacketS2C;
// S2C Connect BSSID Packet
typedef struct
{
SceNetAdhocctlPacketBase base;
SceNetEtherAddr mac;
} __attribute__((packed)) SceNetAdhocctlConnectBSSIDPacketS2C;
// S2C Chat Packet
typedef struct
{
SceNetAdhocctlChatPacketC2S base;
SceNetAdhocctlNickname name;
} __attribute__((packed)) SceNetAdhocctlChatPacketS2C;
#endif