Anope IRC Services  Version 1.8
Functions | Variables
servers.c File Reference
#include "services.h"
Include dependency graph for servers.c:

Go to the source code of this file.

Functions

Serverfirst_server (int flags)
 
Servernext_server (int flags)
 
Servernew_server (Server *uplink, const char *name, const char *desc, uint16 flags, char *suid)
 
static void delete_server (Server *serv, const char *quitreason)
 
Serverfindserver (Server *s, const char *name)
 
Serverfindserver_uid (Server *s, const char *name)
 
int anope_check_sync (const char *name)
 
void do_server (const char *source, char *servername, char *hops, char *descript, char *numeric)
 
void do_squit (const char *source, int ac, char **av)
 
void capab_parse (int ac, char **av)
 
int is_ulined (char *server)
 
int is_sync (Server *server)
 
void finish_sync (Server *serv, int sync_links)
 
void ts6_uid_init (void)
 
void ts6_uid_increment (unsigned int slot)
 
char * ts6_uid_retrieve (void)
 

Variables

Serverservlist = NULL
 
Serverme_server = NULL
 
Serverserv_uplink = NULL
 
uint32 uplink_capab
 
char * uplink
 
char * TS6UPLINK
 
char * TS6SID
 
static Serverserver_cur
 
CapabInfo capab_info []
 
static int ts6_uid_initted = 0
 
static char ts6_new_uid [10]
 
static unsigned int ts6_uid_index = 9
 

Function Documentation

int anope_check_sync ( const char *  name)

Find if the server is synced with the network

Parameters
sServer struct
nameServer Name
Returns
Not Synced returns -1, Synced returns 1, Error returns 0

Definition at line 335 of file servers.c.

References findserver(), and is_sync().

void capab_parse ( int  ac,
char **  av 
)

Handle parsing the CAPAB/PROTOCTL messages

Parameters
acNumber of arguments in av
avAgruments
Returns
void

Definition at line 451 of file servers.c.

References ircdvars_::chanmodes, capabinfo_::flag, ircd, myStrGetToken(), myStrGetTokenRemainder(), ircdvars_::nickchars, ircdvars_::nickip, sstrdup(), stricmp(), capabinfo_::token, and uplink_capab.

Referenced by anope_event_capab().

static void delete_server ( Server serv,
const char *  quitreason 
)
static

Remove and free a Server structure. This function is the most complete remove treatment a server can get, as it first quits all clients which still pretend to be on this server, then it walks through all connected servers and disconnects them too. If all mess is cleared, the server itself will be too.

Parameters
Serverstruct
reasonthe server quit
Returns
void

Definition at line 185 of file servers.c.

References alog(), debug, del_session(), delete_user(), server_::desc, firstuser(), nickcore_::flags, user_::host, ircdcap, is_ulined(), nickalias_::last_quit, nickalias_::last_seen, LimitSessions, server_::links, user_::na, server_::name, nickalias_::nc, server_::next, nextuser(), NI_SUSPENDED, ircdcapab_::noquit, NS_IDENTIFIED, NS_RECOGNIZED, NS_VERBOTEN, server_::prev, ircdcapab_::qs, user_::server, sstrdup(), nickalias_::status, server_::suid, server_::uplink, and uplink_capab.

Referenced by do_squit().

void do_server ( const char *  source,
char *  servername,
char *  hops,
char *  descript,
char *  numeric 
)

Handle adding the server to the Server struct

Parameters
sourceName of the uplink if any
servernameName of the server being linked
hopsNumber of hops to reach this server
descriptDescription of the server
numericServer Numberic/SUID
Returns
void

Definition at line 360 of file servers.c.

References alog(), debug, EVENT_SERVER_CONNECT, fatal(), findserver(), findserver_uid(), ircd, me_server, new_server(), send_event(), ircdvars_::ts6, and UseTS6.

Referenced by anope_event_server(), and anope_event_sid().

void do_squit ( const char *  source,
int  ac,
char **  av 
)

Handle removing the server from the Server struct

Parameters
sourceName of the server leaving
acNumber of arguments in av
avAgruments as part of the SQUIT
Returns
void

Definition at line 398 of file servers.c.

References alog(), anope_cmd_global(), anope_cmd_squit(), BUFSIZE, debug, delete_server(), EVENT_SERVER_SQUIT, findserver(), findserver_uid(), server_::flags, ircd, ircdcap, server_::name, s_OperServ, send_event(), SERVER_JUPED, snprintf(), ircdvars_::ts6, ircdcapab_::unconnect, server_::uplink, uplink_capab, and UseTS6.

Referenced by anope_event_rsquit(), anope_event_squit(), inspircd_cmd_jupe(), and unreal_cmd_jupe().

Server* findserver ( Server s,
const char *  name 
)
Server* findserver_uid ( Server s,
const char *  name 
)

Find a server by UID, returns NULL if not found

Parameters
sServer struct
nameServer Name
Returns
Server struct

Definition at line 298 of file servers.c.

References alog(), debug, server_::links, server_::next, stricmp(), and server_::suid.

Referenced by anope_event_eob(), anope_event_eos(), anope_event_euid(), anope_event_metadata(), anope_event_nick(), anope_event_rsquit(), anope_event_sid(), anope_event_squit(), anope_event_uid(), do_server(), do_sjoin(), do_squit(), inspircd_cmd_jupe(), and ts6_sid_retrieve().

void finish_sync ( Server serv,
int  sync_links 
)
Server* first_server ( int  flags)

Return the first server in the server struct

Parameters
flagsServer Flags, see services.h
Returns
Server Struct

Definition at line 64 of file servers.c.

References server_::flags, next_server(), server_cur, and servlist.

int is_sync ( Server server)

See if the current server is synced, or has an unknown sync state (in which case we pretend it is always synced)

Parameters
serverServer of which we want to know the state
Returns
int 0 if not synced, 1 if synced

Definition at line 516 of file servers.c.

References SSYNC_DONE, SSYNC_UNKNOWN, and server_::sync.

Referenced by anope_check_sync(), chan_adduser2(), chan_create(), chan_set_correct_modes(), do_nick(), do_sjoin(), do_topic(), and finish_sync().

int is_ulined ( char *  server)

Search the uline servers array to find out if the server that just set the mode is in our uline list

Parameters
serverServer Setting the mode
Returns
int 0 if not found, 1 if found

Definition at line 495 of file servers.c.

References NumUlines, stricmp(), and Ulines.

Referenced by bot_kick(), chan_set_correct_modes(), chan_set_modes(), check_ban(), check_kick(), delete_server(), do_kill(), do_nick(), and do_quit().

Server* new_server ( Server uplink,
const char *  name,
const char *  desc,
uint16  flags,
char *  suid 
)
Server* next_server ( int  flags)

Return the next server in the server struct

Parameters
flagsServer Flags, see services.h
Returns
Server Struct

Definition at line 81 of file servers.c.

References server_::flags, server_::links, server_::next, server_cur, and server_::uplink.

Referenced by first_server().

void ts6_uid_increment ( unsigned int  slot)

Definition at line 598 of file servers.c.

References ts6_new_uid, and TS6SID.

Referenced by ts6_uid_retrieve().

void ts6_uid_init ( void  )

Definition at line 584 of file servers.c.

References alog(), snprintf(), ts6_new_uid, ts6_uid_initted, TS6SID, and UseTS6.

Referenced by ts6_uid_retrieve().

char* ts6_uid_retrieve ( void  )

Variable Documentation

CapabInfo capab_info[]
Initial value:
= {
{"NOQUIT", CAPAB_NOQUIT},
{"TSMODE", CAPAB_TSMODE},
{"UNCONNECT", CAPAB_UNCONNECT},
{"NICKIP", CAPAB_NICKIP},
{"SSJOIN", CAPAB_NSJOIN},
{"ZIP", CAPAB_ZIP},
{"BURST", CAPAB_BURST},
{"TS5", CAPAB_TS5},
{"TS3", CAPAB_TS3},
{"DKEY", CAPAB_DKEY},
{"PT4", CAPAB_PT4},
{"SCS", CAPAB_SCS},
{"QS", CAPAB_QS},
{"UID", CAPAB_UID},
{"KNOCK", CAPAB_KNOCK},
{"CLIENT", CAPAB_CLIENT},
{"IPV6", CAPAB_IPV6},
{"SSJ5", CAPAB_SSJ5},
{"SN2", CAPAB_SN2},
{"TOK1", CAPAB_TOKEN},
{"TOKEN", CAPAB_TOKEN},
{"VHOST", CAPAB_VHOST},
{"SSJ3", CAPAB_SSJ3},
{"SJB64", CAPAB_SJB64},
{"CHANMODES", CAPAB_CHANMODE},
{"NICKCHARS", CAPAB_NICKCHARS},
{NULL, 0}
}
#define CAPAB_TS3
Definition: services.h:1373
#define CAPAB_UID
Definition: services.h:1381
#define CAPAB_SSJ5
Definition: services.h:1385
#define CAPAB_NICKCHARS
Definition: services.h:1396
#define CAPAB_DKEY
Definition: services.h:1375
#define CAPAB_NOQUIT
Definition: services.h:1366
#define CAPAB_VHOST
Definition: services.h:1387
#define CAPAB_NICKIP
Definition: services.h:1369
#define CAPAB_TOKEN
Definition: services.h:1388
#define CAPAB_SN2
Definition: services.h:1386
#define CAPAB_TSMODE
Definition: services.h:1367
#define CAPAB_QS
Definition: services.h:1378
#define CAPAB_UNCONNECT
Definition: services.h:1368
#define CAPAB_CHANMODE
Definition: services.h:1394
#define CAPAB_SSJ3
Definition: services.h:1389
#define CAPAB_NSJOIN
Definition: services.h:1370
#define CAPAB_CLIENT
Definition: services.h:1383
#define CAPAB_SJB64
Definition: services.h:1395
#define CAPAB_BURST
Definition: services.h:1372
#define CAPAB_PT4
Definition: services.h:1380
#define CAPAB_TS5
Definition: services.h:1374
#define CAPAB_SCS
Definition: services.h:1379
#define CAPAB_IPV6
Definition: services.h:1384
#define CAPAB_ZIP
Definition: services.h:1371
#define CAPAB_KNOCK
Definition: services.h:1382

Definition at line 27 of file servers.c.

Server* me_server = NULL

Definition at line 17 of file servers.c.

Referenced by do_server().

Server* serv_uplink = NULL

Definition at line 18 of file servers.c.

Server* server_cur
static

Definition at line 25 of file servers.c.

Referenced by first_server(), and next_server().

Server* servlist = NULL

Definition at line 16 of file servers.c.

Referenced by first_server(), and new_server().

char ts6_new_uid[10]
static

Definition at line 581 of file servers.c.

Referenced by ts6_uid_increment(), ts6_uid_init(), and ts6_uid_retrieve().

unsigned int ts6_uid_index = 9
static

Definition at line 582 of file servers.c.

Referenced by ts6_uid_retrieve().

int ts6_uid_initted = 0
static

Definition at line 580 of file servers.c.

Referenced by ts6_uid_init(), and ts6_uid_retrieve().

char* TS6SID

Definition at line 22 of file servers.c.

Referenced by ts6_uid_increment(), and ts6_uid_init().

char* TS6UPLINK

Definition at line 21 of file servers.c.

char* uplink

Definition at line 20 of file servers.c.

Referenced by new_server().

uint32 uplink_capab

Definition at line 19 of file servers.c.

Referenced by capab_parse(), delete_server(), and do_squit().