summaryrefslogtreecommitdiffstats
path: root/pttbbs/include/daemons.h
blob: 32bb1c680c78d5bc5bde954d42536b3e9c78f15c (plain) (blame)
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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
#ifndef _BBS_DAEMONS_H

#include "pttstruct.h"

///////////////////////////////////////////////////////////////////////
// From Host Nick Daemon (fromd)

#ifndef FROMD_ADDR
#define FROMD_ADDR      ":5130"
#endif

///////////////////////////////////////////////////////////////////////
// Register E-Mail Database Daemon (regmaild)

#ifndef REGMAILD_ADDR
#define REGMAILD_ADDR   ":5131"
#endif

enum {
    REGMAILDB_REQ_COUNT = 1,
    REGMAILDB_REQ_SET,
    REGCHECK_REQ_AMBIGUOUS,
};

typedef struct
{
    size_t cb;
    int  operation;
    char userid   [IDLEN+1];
    char email    [50]; // TODO define const in pttstruct.h
}   regmaildb_req;


///////////////////////////////////////////////////////////////////////
// Login Daemon (logind)

typedef struct login_data
{
    // size of current structure
    size_t cb;
    void   *ack;

    // terminal information
    int  t_lines, t_cols;
    int  encoding;
    Fnv32_t client_code;

    // user authentication
    char userid[IDLEN+1];
    char hostip[IPV4LEN+1];
    char port  [IDLEN+1];

}   login_data;

///////////////////////////////////////////////////////////////////////
// Angel Beats! Daemon

#ifndef ANGELBEATS_ADDR
#define ANGELBEATS_ADDR   ":5132"
#endif

// Merge perf in every X seconds.
#ifndef ANGELBEATS_PERF_MIN_PERIOD
#define ANGELBEATS_PERF_MIN_PERIOD  (600)
#endif

enum ANGELBEATS_OPERATIONS {
    ANGELBEATS_REQ_INVALID = 0,
    ANGELBEATS_REQ_REPORT,
    ANGELBEATS_REQ_RELOAD,
    ANGELBEATS_REQ_SUGGEST,
    ANGELBEATS_REQ_SUGGEST_AND_LINK,
    ANGELBEATS_REQ_REMOVE_LINK,
    ANGELBEATS_REQ_HEARTBEAT,
    ANGELBEATS_REQ_GET_ONLINE_LIST,
    ANGELBEATS_REQ_EXPORT_PERF,
    ANGELBEATS_REQ_REG_NEW,
    ANGELBEATS_REQ_BLAME,
    ANGELBEATS_REQ_SAVE_STATE,
    ANGELBEATS_REQ_MAX,
};

typedef struct {
    short cb;           // size of current structure
    short operation;

    int angel_uid;
    int master_uid;
}   angel_beats_data;

typedef struct {
    short cb;
    short total_angels;
    short total_online_angels;
    short total_active_angels;

    short min_masters_of_online_angels;
    short max_masters_of_online_angels;
    short min_masters_of_active_angels;
    short max_masters_of_active_angels;

    short my_index;
    short my_active_index;
    short my_active_masters;
    short inactive_days;

    time4_t last_assigned;
    int     missed_assign;
    int     last_assigned_master;

}   angel_beats_report ;

#define ANGELBEATS_UID_LIST_SIZE    (20)

typedef struct {
    short cb;
    short angels;
    int uids[ANGELBEATS_UID_LIST_SIZE];
}   angel_beats_uid_list;

///////////////////////////////////////////////////////////////////////
// Brc Storage Daemon

#ifndef BRCSTORED_ADDR
#define BRCSTORED_ADDR   ":5133"
#endif

enum BRCSTORED_OPERATIONS {
    BRCSTORED_REQ_INVALID = 0,
    BRCSTORED_REQ_READ = 'r',
    BRCSTORED_REQ_WRITE = 'w',
};

///////////////////////////////////////////////////////////////////////
// Comments Daemon

#ifndef COMMENTD_ADDR
#define COMMENTD_ADDR   ":5134"
#endif

#ifndef COMMENTLEN
#define COMMENTLEN (80)
#endif

enum {
    COMMENTD_REQ_ADD = 1,
    COMMENTD_REQ_QUERY_COUNT,
    COMMENTD_REQ_QUERY_BODY,
    COMMENTD_REQ_MARK_DELETED,
};

typedef struct CommentBodyReq {
    time4_t time;
    time4_t ipv4;
    uint32_t userref; /* user.ctime */
    int32_t type;
    char userid[IDLEN + 1];
    char msg[COMMENTLEN + 1];
} PACKSTRUCT CommentBodyReq;

typedef struct {
    char board[IDLEN + 1];
    char file[FNLEN + 1];
} PACKSTRUCT CommentKeyReq;

typedef struct {
    short cb;
    short operation;
    CommentBodyReq comment;
    CommentKeyReq key;
} PACKSTRUCT CommentAddRequest;

typedef struct {
    short cb;
    short operation;
    uint32_t start;
    CommentKeyReq key;
} PACKSTRUCT CommentQueryRequest;

///////////////////////////////////////////////////////////////////////
// Posts Daemon
//
#ifndef POSTD_ADDR
#define POSTD_ADDR   ":5135"
#endif

enum {
    POSTD_REQ_ADD = 1,
    POSTD_REQ_IMPORT,
    POSTD_REQ_GET_CONTENT,
};

typedef struct {
    uint32_t userref; /* user.ctime */
    uint32_t ctime;   /* post ctime */
    uint32_t ipv4;    /* user.fromhost */
    char userid[IDLEN + 1];
} PACKSTRUCT PostAddExtraInfoReq;

typedef struct {
    char board[IDLEN + 1];
    char file[FNLEN + 1];
} PACKSTRUCT PostKeyReq;

typedef struct {
    short cb;
    short operation;
    fileheader_t header;
    PostAddExtraInfoReq extra;
    PostKeyReq key;
} PACKSTRUCT PostAddRequest;

typedef struct {
    short cb;
    short operation;
    PostKeyReq key;
} PACKSTRUCT PostGetContentRequest;

///////////////////////////////////////////////////////////////////////
// online friend relation daemon
//
typedef struct {
    int     index; //  SHM->uinfo[index]
    int     uid;   // 踹 cache server 銝銝甇, 蝣箄.
    int     friendstat;
    int     rfriendstat;
} ocfs_t;

#endif // _BBS_DAEMONS_H

// vim:et