/* -TAG:LICENSE-
   
   This file is under the DigitalSpark Freeware Class License, see the
   file LICENSE for complete licensing information.
                                                         
                                                         -TAG:LICENSE- */
#ifdef MAIN
int	ServerConnected=0;
int	ClientConnected=0;
int	ServerSock;
int	Authorized=0;
char	IRCServer[100];
char	ZeroZeroFour[1024];
char	ZeroZeroFive[1024];
char	Nick[30];
char	User[50];
char	IDString[1024];
pthread_mutex_t clientsock_mutex = PTHREAD_MUTEX_INITIALIZER; 
pthread_mutex_t serversock_mutex = PTHREAD_MUTEX_INITIALIZER; 
pthread_mutex_t conbuff_mutex = PTHREAD_MUTEX_INITIALIZER; 
char	*Channels[30];
int	RefreshWhois=1;
int	ServerAuth=0;
int	NickError=0;
int	Detach=1;
char    *connectbuf[1024];
int     ConBufSize=0;
#else
extern	int	ServerConnected;
extern	int	ClientConnected;
extern	int	ServerSock;
extern	int	Authorized;
extern	char	IRCServerID[100];
extern	char	IRCServer[100];
extern	char	ZeroZeroFour[1024];
extern	char	ZeroZeroFive[1024];
extern	char	Nick[30];
extern	char	User[50];
extern	char	IDString[1024];
extern	pthread_mutex_t clientsock_mutex; 
extern	pthread_mutex_t serversock_mutex; 
extern	pthread_mutex_t conbuff_mutex;
extern	char	*Channels[30];
extern	int	RefreshWhois;
extern	int	ServerAuth;
extern	int	NickError;
extern	int	Detach;
extern	char    *connectbuf[1024];
extern	int     ConBufSize;
#endif


// client bus struct
#define MAX_CLIENTS	20

#ifdef MAIN
int	cBus_Connected=0;
struct NetworkingBus {
#else
extern	int	cBus_Connected;
extern struct NetworkingBus {
#endif
	int	State;
	int	Sock;
	int	Authorized;
	char	*Info;
	pthread_mutex_t Mutex;
} Client[MAX_CLIENTS];

#define	CS_FREE		0
#define CS_WAITFOR	5
#define CS_NEEDBRIDGE	7
#define CS_USED		10

#ifndef IN_CB
extern	int	cBusAdd( int Sock, char *Info );
extern	int	cBusRemove( int Sock );
extern	int	cBusBroadcast( char *data, int size );
#endif
