-
Notifications
You must be signed in to change notification settings - Fork 26
/
orp-conf.h
128 lines (113 loc) · 3.6 KB
/
orp-conf.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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
//////////////////////////////////////////////////////////////////////////////
//
// Open Remote Play
// http://code.google.com/p/open-rp/
//
//////////////////////////////////////////////////////////////////////////////
//
// 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, write to the Free Software Foundation, Inc.,
// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//
//////////////////////////////////////////////////////////////////////////////
#ifndef _ORP_CONFIG_H
#define _ORP_CONFIG_H
#ifndef ORP_PSP
#include <SDL/SDL_stdinc.h>
#endif
#define ORP_KEY_LEN 16
#define ORP_MAC_LEN 6
#define ORP_NICKNAME_LEN 128
#define ORP_HOSTNAME_LEN 128
// Default Remote Play TCP/UDP port
#define ORP_PORT 9293
// WoL packet length
#define ORP_WOLPKT_LEN 256
// Config format version
#define ORP_CONFIG_VER 2
// Config header and record flags
#define ORP_CONFIG_DELETED 0x10000000
#define ORP_CONFIG_EXPORT 0x20000000
#define ORP_CONFIG_KEYS 0x40000000
#define ORP_CONFIG_NOSRCH 0x80000000
#define ORP_CONFIG_WOLR 0x01000000
#define ORP_CONFIG_BR384 0x02000000
#define ORP_CONFIG_BR768 0x04000000
#define ORP_CONFIG_BR1024 0x08000000
#define ORP_CONFIG_BR256 0x00100000
#define ORP_CONFIG_BR512 0x00200000
#define ORP_CONFIG_PRIVATE 0x00400000
struct orpConfigHeader_t
{
Uint8 magic[3];
Uint8 version;
Uint32 flags;
Uint8 reserved[8];
Uint8 skey0[ORP_KEY_LEN];
Uint8 skey1[ORP_KEY_LEN];
Uint8 skey2[ORP_KEY_LEN];
};
struct orpConfigRecord_v1_t
{
Uint32 flags;
Uint16 ps3_port;
Uint8 ps3_hostname[ORP_HOSTNAME_LEN];
Uint8 ps3_nickname[ORP_NICKNAME_LEN];
Uint8 ps3_mac[ORP_MAC_LEN];
Uint8 psp_mac[ORP_MAC_LEN];
Uint8 psp_id[ORP_KEY_LEN];
Uint8 psp_owner[ORP_NICKNAME_LEN];
Uint8 pkey[ORP_KEY_LEN];
};
#define orpConfigRecord_t orpConfigRecord_v2_t
struct orpConfigRecord_v2_t
{
Uint32 flags;
Uint16 ps3_port;
Uint8 ps3_hostname[ORP_HOSTNAME_LEN];
Uint8 ps3_nickname[ORP_NICKNAME_LEN];
Uint8 ps3_mac[ORP_MAC_LEN];
Uint8 psp_mac[ORP_MAC_LEN];
Uint8 psp_id[ORP_KEY_LEN];
Uint8 psp_owner[ORP_NICKNAME_LEN];
Uint8 pkey[ORP_KEY_LEN];
Uint8 psn_login[ORP_NICKNAME_LEN];
};
#ifndef ORP_PSP
struct orpConfigCtx_t
{
FILE *h_file;
char *filename;
struct orpConfigHeader_t header;
};
enum orpID_KEY {
orpID_KEY_0,
orpID_KEY_1,
orpID_KEY_2
};
int orpConfigOpen(struct orpConfigCtx_t *ctx, const char *filename);
int orpConfigUpgrade(struct orpConfigCtx_t *ctx);
int orpConfigClose(struct orpConfigCtx_t *ctx);
int orpConfigRewind(struct orpConfigCtx_t *ctx);
int orpConfigRead(struct orpConfigCtx_t *ctx, struct orpConfigRecord_t *rec);
long orpConfigFind(struct orpConfigCtx_t *ctx, struct orpConfigRecord_t *rec);
int orpConfigDelete(struct orpConfigCtx_t *ctx, const char *nickname);
int orpConfigSave(struct orpConfigCtx_t *ctx, struct orpConfigRecord_t *rec);
int orpConfigGetKey(struct orpConfigCtx_t *ctx, enum orpID_KEY which, Uint8 *dst);
int orpConfigSetKey(struct orpConfigCtx_t *ctx, enum orpID_KEY which, Uint8 *src);
#ifdef ORP_CONFIG_DEBUG
void orpConfigDebug(struct orpConfigCtx_t *ctx, FILE *output);
#endif
#endif // ORP_PSP
#endif // _ORP_CONFIG_H
// vi: ts=4