File: querycmds.h

package info (click to toggle)
ircd 2.10.04-2
  • links: PTS
  • area: main
  • in suites: slink
  • size: 2,248 kB
  • ctags: 2,145
  • sloc: ansic: 26,591; makefile: 666; sh: 418; perl: 18
file content (75 lines) | stat: -rw-r--r-- 2,911 bytes parent folder | download
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
#ifndef QUERYCMDS_H
#define QUERYCMDS_H

/*=============================================================================
 * Structs
 */

struct lusers_st {
  /* Local connections: */
  unsigned int unknowns;	/* IsUnknown() || IsConnecting() || IsHandshake() */
  unsigned int local_servers;	/* IsServer() && MyConnect() */
  unsigned int local_clients;	/* IsClient() && MyConnect() */
  /* Global counts: */
  unsigned int servers;		/* IsServer() || IsMe() */
  unsigned int clients;		/* IsClient() */
  /* Global user mode changes: */
  unsigned int inv_clients;	/* IsClient() && IsInvisible() */
  unsigned int opers;		/* IsClient() && IsOper() */
  /* Misc: */
  unsigned int channels;
};

/*=============================================================================
 * Macros
 */

/* Macros for remote connections: */
#define Count_newremoteclient(nrof)		(++nrof.clients)
#define Count_newremoteserver(nrof)		(++nrof.servers)
#define Count_remoteclientquits(nrof)		(--nrof.clients)
#define Count_remoteserverquits(nrof)		(--nrof.servers)

/* Macros for local connections: */
#define Count_newunknown(nrof)			(++nrof.unknowns)
#define Count_unknownbecomesclient(cptr, nrof) \
  do { \
    --nrof.unknowns; ++nrof.local_clients; ++nrof.clients; \
    if (match("*" DOMAINNAME, cptr->sockhost) == 0) \
      ++current_load.local_count; \
    if (nrof.local_clients > max_client_count) \
      max_client_count = nrof.local_clients; \
    if (nrof.local_clients + nrof.local_servers > max_connection_count) \
    { \
      max_connection_count = nrof.local_clients + nrof.local_servers; \
      if (max_connection_count % 10 == 0) \
        sendto_ops("Maximum connections: %d (%d clients)", \
	    max_connection_count, max_client_count); \
    } \
  } while(0)
#define Count_unknownbecomesserver(nrof)	do { --nrof.unknowns; ++nrof.local_servers; ++nrof.servers; } while(0)
#define Count_clientdisconnects(cptr, nrof) \
  do \
  { \
    --nrof.local_clients; --nrof.clients; \
    if (match("*" DOMAINNAME, cptr->sockhost) == 0) \
      --current_load.local_count; \
  } while(0)
#define Count_serverdisconnects(nrof)		do { --nrof.local_servers; --nrof.servers; } while(0)
#define Count_unknowndisconnects(nrof)		(--nrof.unknowns)

/*=============================================================================
 * Proto types
 */

extern int m_version(aClient *cptr, aClient *sptr, int parc, char *parv[]);
extern int m_info(aClient *cptr, aClient *sptr, int parc, char *parv[]);
extern int m_links(aClient *cptr, aClient *sptr, int parc, char *parv[]);
extern int m_help(aClient *cptr, aClient *sptr, int parc, char *parv[]);
extern int m_lusers(aClient *cptr, aClient *sptr, int parc, char *parv[]);
extern int m_admin(aClient *cptr, aClient *sptr, int parc, char *parv[]);
extern int m_motd(aClient *cptr, aClient *sptr, int parc, char *parv[]);

extern struct lusers_st nrof;

#endif /* QUERYCMDS_H */