X-Git-Url: http://git.pk910.de/?a=blobdiff_plain;f=src%2FClientSocket.h;h=37543998855b2e63d7690698dcfc029e7a79e048;hb=2b9e305af713f0960ac0cd7645af3e0ef85a8515;hp=380e051951522ebaef2a5f602f23e9c67e52f493;hpb=0f1dc61921eef1db8e404a5a82372e2d1cd55daa;p=NeonServV5.git diff --git a/src/ClientSocket.h b/src/ClientSocket.h index 380e051..3754399 100644 --- a/src/ClientSocket.h +++ b/src/ClientSocket.h @@ -1,3 +1,19 @@ +/* ClientSocket.h - NeonServ v5.3 + * Copyright (C) 2011-2012 Philipp Kreil (pk910) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ #ifndef _ClientSocket_h #define _ClientSocket_h @@ -6,39 +22,74 @@ #define SOCKET_FLAG_DEAD 0x01 #define SOCKET_FLAG_CONNECTED 0x02 #define SOCKET_FLAG_READY 0x04 -#define SOCKET_FLAG_PREFERRED 0x08 /* prefered bot to send datas to the IRC World (NOTICE's WHO's etc pp) */ +#define SOCKET_FLAG_PREFERRED 0x08 /* prefered bot to send datas to the IRC World (NOTICE's WHO's etc pp) */ +#define SOCKET_FLAG_USE_QUEUE 0x10 +#define SOCKET_FLAG_RECONNECT 0x20 +#define SOCKET_FLAG_SSL 0x40 +#define SOCKET_FLAG_HAVE_SSL 0x80 +#define SOCKET_FLAG_QUITTED 0x100 +#define SOCKET_FLAG_FAST_JUMP 0x200 +#define SOCKET_FLAG_SILENT 0x400 + +#define SOCKET_HAVE_BOTCLASSVALUE1 0x10000000 +#define SOCKET_HAVE_BOTCLASSVALUE2 0x20000000 +#define SOCKET_HAVE_BOTCLASSVALUE3 0x40000000 #define BUF_SIZ 512 struct UserNode; struct trigger_cache; +struct SSLConnection; struct ClientSocket { int sock; - unsigned char flags; + unsigned int flags; char buffer[BUF_SIZ*2]; //we need to store up to 2 full commands at once unsigned int bufferpos; char *host; int port; + char *bind; char *pass; + char *nick; + char *ident; + char *realname; struct UserNode *user; unsigned long traffic_in; unsigned long traffic_out; time_t connection_time; + struct SSLConnection *sslconn; + + struct BotQueue *queue; + + struct WHOQueueEntry *whoqueue_first; + struct WHOQueueEntry *whoqueue_last; + + struct HandleInfoQueueEntry *handleinfo_first; + struct HandleInfoQueueEntry *handleinfo_last; int botid : 16; int clientid : 16; + void *botclassvalue1; + void *botclassvalue2; + void *botclassvalue3; + struct ClientSocket *next; }; -struct ClientSocket* create_socket(char *host, int port, char *pass, struct UserNode *user); +struct ClientSocket* create_socket(char *host, int port, char *bindto, char *pass, char *nick, char *ident, char *realname); int connect_socket(struct ClientSocket *client); int close_socket(struct ClientSocket *client); +int disconnect_socket(struct ClientSocket *client); +int write_socket_force(struct ClientSocket *client, char* msg, int len); int write_socket(struct ClientSocket *client, char* msg, int len); +#ifdef HAVE_THREADS +int clientsocket_parseorder_top(unsigned int tid); +#endif void socket_loop(int timeout_seconds); void putsock(struct ClientSocket *client, const char *text, ...) PRINTF_LIKE(2, 3); struct ClientSocket* getBots(int flags, struct ClientSocket* last_bot); +void init_sockets(); void free_sockets(); #endif \ No newline at end of file