bbreg.h
3.27 KB
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
#ifndef __BBREG_H__
#define __BBREG_H__
#ifdef __cplusplus
extern "C" {
#endif
/*
BB Player User Registration Data Structure.
Refer to rf/doc/bbdepto/software/Customer-ID.html for the
description of fields. The following fields: first_reg_date and
submit are new.
first_reg_date - the first time the BB Player registers
itself to the server (may be used for warranty purpose).
It is in YYMMDD format to avoid the need to translate
seconds into a display format by the player.
submit - whenever the BB player modifies user_data, the BB player
sets "submit" to 1. The Depot re-registers the user_data
if "submit" is set to 1. The Depot resets it to 0 after
successful registration.
encoding - specify the encoding of the name and address field
bb_id - BB player ID
bbplayer_signature - RSA signature of the user data in the
UserRegData struct.
All variable-length fields are null-terminated,
if their data lengths are smaller than their allocated storage sizes. */
#define UR_VERSION_LEN 4
#define UR_SIG_LEN 128
#define UR_DATA_LEN 1024
#define UR_SERVER_DATA_LEN 1024
#define UR_BB_ID_LEN 4
#define UR_NAME_LEN 32
#define UR_DATE_LEN 8
#define UR_ADDRESS_LEN 160
#define UR_EMAIL_LEN 32
#define UR_PHONE_LEN 16
#define UR_PINYIN_LEN (16*7)
typedef struct {
char version[UR_VERSION_LEN]; /* Data structure version in
big endian binary format */
char bbplayer_signature[UR_SIG_LEN]; /* 1024 bit RSA signature,
ignored for now */
char user_data[UR_DATA_LEN];
char server_data[UR_SERVER_DATA_LEN];
} UserRegFile;
typedef struct {
char bb_id[UR_BB_ID_LEN]; /* bb id in big endian (binary
format) */
char encoding; /* '0' - UTF8,
'1' - GB2312 */
char submit; /* '0' - dont submit;
'1' - submit */
char birthdate[UR_DATE_LEN]; /* 8 numeric char, format is
YYYYMMDD */
char name[UR_NAME_LEN]; /* 16 GB or 32 ASCII char */
char address[UR_ADDRESS_LEN]; /* 80 GB or 160 ASCII char */
char phone[UR_PHONE_LEN]; /* 16 numeric char */
char pinyin[UR_PINYIN_LEN]; /* 16*7 alphabetical char, delimited by ' '*/
char sex; /* '0' - not known,
'1' - female,
'2' - male */
} UserRegData;
typedef struct {
char first_reg_date[UR_DATE_LEN]; /* 1st registration date, format
is YYYYMMDD */
char email[UR_EMAIL_LEN]; /* email id assigned by server */
} UserRegServerData;
/* BB interface for iQue Club use */
#define BB_USER_REG_SUCCESS 0
#define BB_USER_REG_ERR_FS -1
#define UR_VERSION 1
extern UserRegData gBbUserRegInfo;
extern char gBbClubId[UR_EMAIL_LEN];
extern int bbReadRegFile();
extern int bbWriteRegFile();
extern void bbClubExit();
#ifdef __cplusplus
}
#endif
#endif /* __BBREG_H__ */