1 |
/** |
2 |
* sourceinfo.h: Data structures for sourceinfo |
3 |
* |
4 |
* Copyright © 2007 Pippijn van Steenhoven / The Ermyth Team |
5 |
* Rights to this code are as documented in COPYING. |
6 |
* |
7 |
* |
8 |
* Portions of this file were derived from sources bearing the following license: |
9 |
* Copyright © 2006 Atheme Development Group |
10 |
* Rights to this code are as documented in doc/pod/license.pod. |
11 |
* |
12 |
* $Id: sourceinfo.h,v 1.4 2007-08-30 19:56:20 pippijn Exp $ |
13 |
*/ |
14 |
|
15 |
#ifndef SOURCEINFO_H |
16 |
#define SOURCEINFO_H |
17 |
|
18 |
struct sourceinfo_vtable |
19 |
{ |
20 |
const char *description; |
21 |
void (*cmd_fail) (sourceinfo_t *si, fault::code code, char const * const message); |
22 |
void (*cmd_success_nodata) (sourceinfo_t *si, char const * const message); |
23 |
void (*cmd_success_string) (sourceinfo_t *si, char const * const result, char const * const message); |
24 |
}; |
25 |
|
26 |
/* structure describing data about a protocol message or service command */ |
27 |
struct sourceinfo_t |
28 |
{ |
29 |
/* fields describing the source of the message */ |
30 |
/* for protocol modules, the following applies to su and s: |
31 |
* at most one of these two can be non-NULL |
32 |
* before server registration, both are NULL, otherwise exactly |
33 |
* one is NULL. |
34 |
* for services commands, s is always NULL and su is non-NULL if |
35 |
* and only if the command was received via IRC. |
36 |
*/ |
37 |
user_t *su; /* source, if it's a user */ |
38 |
server_t *s; /* source, if it's a server */ |
39 |
|
40 |
connection_t *connection; /* physical connection cmd received from */ |
41 |
const char *sourcedesc; /* additional information (e.g. IP address) */ |
42 |
myuser_t *smu; /* login associated with source */ |
43 |
|
44 |
service_t *service; /* destination service */ |
45 |
|
46 |
channel_t *c; /* channel this command applies to (fantasy?) */ |
47 |
|
48 |
struct sourceinfo_vtable *v; /* function pointers, could be NULL */ |
49 |
void *callerdata; /* opaque data pointer for caller */ |
50 |
}; |
51 |
|
52 |
#endif |