⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 irc-proto.h

📁 Serveez是一个服务器框架
💻 H
📖 第 1 页 / 共 2 页
字号:
/* * irc-proto.h - IRC protocol header definitions * * Copyright (C) 2000, 2001 Stefan Jahn <stefan@lkcc.org> * * This 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 2, or (at your option) * any later version. *  * This software 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 package; see the file COPYING.  If not, write to * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA.   * * $Id: irc-proto.h,v 1.22 2001/09/27 15:47:36 ela Exp $ * */#ifndef __IRC_PROTO_H__#define __IRC_PROTO_H__#if HAVE_CONFIG_H# include <config.h>#endif#define _GNU_SOURCE#include <time.h>#include "irc-core/irc-core.h"/* Some restrictions. */#define MAX_CHANNEL_LEN       200 /* maximum channel name length */#define INVALID_CHANNEL_CHARS "\007, "#define IRC_PING_INTERVAL (3*60)  /* three (3) minutes intervals */#define MAX_MODE_LEN   32   /* length of mode string (user or channel) */#define MAX_NICK_LEN   16   /* nick name length */#define MAX_NAME_LEN   256  /* name length */#define MAX_MSG_LEN    512  /* length of an IRC message */#define MAX_CHANNELS   32   /* maximum amount of channels per client */#define MAX_CLIENTS    128  /* maximum amount of clients per channels */#define MAX_MOTD_LINES 256  /* Message of the Day lines */#define MOTD_LINE_LEN  80   /* lenght of one MOTD line */#if ENABLE_TIMESTAMP  # define TS_CURRENT 1       /* current (highest) TS version */# define TS_MIN     1       /* the lowest TS version  */# define TS_PASS    "TS"    /* passed as second arg in PASS */#endif/* * Useful typedefs. */typedef struct irc_client irc_client_t;typedef struct irc_client_history irc_client_history_t;typedef struct irc_ban irc_ban_t;typedef struct irc_channel irc_channel_t;typedef struct irc_server irc_server_t;typedef struct irc_connection_class irc_class_t;typedef struct irc_user_authorization irc_user_t;typedef struct irc_oper_authorization irc_oper_t;typedef struct irc_kill_user irc_kill_t;typedef struct irc_configuration irc_config_t;/* * This structure contains all the information for an IRC connection * class which is defined with a Y line. */struct irc_connection_class{  int nr;            /* class number */  int ping_freq;     /* ping frequency in seconds */  int connect_freq;  /* connect frequency in seconds, zero for clients */  int max_links;     /* maximum number of links */  int links;         /* current number of links */  int sendq_size;    /* send queue size */  char *line;        /* referring Y line */  irc_class_t *next; /* pointer to next connection class */};/* * This structure contains an IRC user authorization defined in * a I line within the configuration. */struct irc_user_authorization{  char *user_ip;    /* username, "NOMATCH" to force user@host */  char *ip;         /* IP address mask */  char *user_host;  /* username mask */  char *host;       /* host name mask */  char *password;   /* optional password */  int class;        /* connection class number */  char *line;       /* referring I line */  irc_user_t *next; /* pointer to next user authorization */};/* * The following structure defines an IRC operator authorization line * as given in a O or o line. */struct irc_oper_authorization{  int local;        /* is the operator local or network wide ? */  char *nick;       /* nick name */  char *user;       /* user name, only matched if '@' is given */  char *host;       /* host name mask */  char *password;   /* password */  int class;        /* connection class */  char *line;       /* referring O or o line */  irc_oper_t *next; /* pointer to next structure in list */};/* * This is a structure containing the information about banned users * which can be defined in a K line. */struct irc_kill_user{  char *user;       /* user name mask */  char *host;       /* host name mask */  int start;        /* start time, defining a time span */  int end;          /* end time */  char *line;       /* referring K line */  irc_kill_t *next; /* next structure */};/* * Client structure. */struct irc_client{  char *nick;              /* nick name */  char *real;              /* real name */  char *user;              /* user name (ident) */  char *host;              /* host name (nslookup) */  char *server;            /* the server the client is connected to */  irc_channel_t **channel; /* array of channels this client joined */  int channels;            /* amount of channels the client joined */  svz_socket_t *sock;      /* this clients socket structure */  int flag;                /* this client's user flags */  svz_uint8_t key;         /* the key */  char *pass;              /* the given password */  char *away;              /* the away message if UMODE_AWAY is set */  int hopcount;            /* the client's hopcount (server distance) */  time_t since;            /* signon time */  int ping;                /* ping <-> pong counter */  int registered;          /* is client fully registered ? */  int recv_packets;        /* amount of received messages */  int recv_bytes;          /* received bytes */  int send_packets;        /* amount of sent messages */  int send_bytes;          /* sent bytes */};/* * Client history structure. */struct irc_client_history{  char *nick;                 /* nick name */  char *real;                 /* real name */  char *user;                 /* user name (ident) */  char *host;                 /* host name (nslookup) */  irc_client_history_t *next; /* next client in the history list */};/* * Ban Mask structure. */struct irc_ban{  char *nick;   /* nick name */  char *user;   /* user name */  char *host;   /* host name */  char *by;     /* created by: "nick!user@host" */  time_t since; /* banned since */};/* * Channel structure. */struct irc_channel{  char *name;            /* channel name (max. 200 characters) */  char *topic;           /* current topic */  char *topic_by;        /* topic set by */  time_t topic_since;    /* topic set at */  irc_client_t **client; /* array of clients in this channel */  int *cflag;            /* these clients's channel flags */  int clients;           /* clients in this channel */  int flag;              /* channel flags */  irc_ban_t **ban;       /* channel bans */  int bans;              /* amount of active channel bans */  int users;             /* user limit */  char *key;             /* the channel key */  char *by;              /* this channel is created by */  time_t since;          /* channel exists since */  irc_client_t **invite; /* array of invited clients */  int invites;           /* number of invited clients */};/* * Server structure. */struct irc_server{  char *realhost;                 /* real host */  unsigned long addr;             /* the actual network address */  unsigned short port;            /* tcp port */  char *host;                     /* server name (virtual host) */  char *pass;                     /* password */  int id;                         /* socket id */  int connected;                  /* is that server really connected ? */  int class;                      /* connection class number */  int connect;                    /* connect = 1 (C line), = 0 (N line) */  irc_config_t *cfg;              /* irc server configuration hash */  irc_server_t *next;             /* next server in the list */};/* * IRC server configuration hash. */struct irc_configuration{  int operators;                  /* amount of logged in server operators */  int users;                      /* amount of logged in users */  int unknowns;                   /* unknown connections */  int invisibles;                 /* invisible users */  char *host;                     /* local server virtual host */  char *realhost;                 /* local server host */  int port;  int users_disabled;             /* is USERS command disabled ? */#if ENABLE_TIMESTAMP    time_t tsdelta;                 /* delta value to UTC */#endif  char *MOTD[MAX_MOTD_LINES];     /* the message of the day */  int MOTDs;                      /* amount of lines in this message */  time_t MOTD_lastModified;       /* last modified date */  char *MOTD_file;                /* the file name */  /*    * M [Mandatory] -- this IRC server's configuration   *   * :virtual host name   * :optional bind address (real host name)   * :text name   * :port   */  char *MLine;  /*    * A [Mandatory] -- administrative info, printed by the /ADMIN command   *   * :administrative info (department, university)   * :the server's geographical location   * :email address for a person responsible for the irc server   */  char *ALine;  /*    * Y [Suggested] -- connection class   *   * :class number (higher numbers refer to a higher priority)   * :ping frequency (in seconds)   * :connect frequency in seconds for servers, 0 for client class   * :maximum number of links in this class    * :send queue size   */  svz_array_t *YLine;  /*   * I [Mandatory] -- authorize client, wildcards permitted, a valid client   *                  is matched "user@ip" OR "user@host"   *   * :user@ip, you can specify "NOMATCH" here to force matching user@host   * :password (optional)   * :user@host   * :password (optional)   * :connection class number (YLine)   */  svz_array_t *ILine;  /*   * O [Optional] -- authorize operator, wildcards allowed   * :user@host, user@ forces checking ident   * :password   * :nick   */  svz_array_t *OLine;  /*   * o [Optional] -- authorize local operator, see above at the O lines for   *                 description   */  svz_array_t *oLine;  /*   * Note: + C and N lines can also use the user@ combination in order   *         to check specific users (ident) starting servers   *       + C and N lines are usually given in pairs   */  /*   * C [Networked] -- server to connect to   * :host name   * :password   * :server name (virtual)   * :port (if not given we will not connect)   * :connection class number (YLine)   */  svz_array_t *CLine;  /*   * N [Networked] -- server which may connect   * :host name   * :password   * :server name (virtual host name)   * :password   * :how many components of your own server's name to strip off the   *  front and be replaced with a *.   * :connection class number (YLine)   */  svz_array_t *NLine;  /*   * K [Optional] -- kill user, wildcards allowed   * :host   * :time of day   * :user   */  svz_array_t *KLine;  char *pass;                     /* server password */  char *info;                     /* server info */  char *email;                    /* email */  char *admininfo;                /* administrative info */  char *location1;                /* city, state, country */  char *location2;                /* university, department */  svz_hash_t *channels;           /* channel hash */  svz_hash_t *clients;            /* client hash */  irc_server_t *servers;          /* server list root */  irc_client_history_t *history;  /* client history list root */  irc_class_t *classes;           /* connection classes list */  irc_user_t *user_auth;          /* user authorizations */  irc_oper_t *operator_auth;      /* operator autorizations */  irc_kill_t *banned;             /* banned users */  char *info_file;                /* name of the /INFO file */};/* * This structure contains all an IRC command needs to exist. */typedef struct{  int count;     /* the command has been count times processed */  char *request; /* name of the command */  int (* func)(svz_socket_t *, irc_client_t *, irc_request_t *);}irc_callback_t;extern irc_callback_t irc_callback[];/* Export the irc server definition to `server.c'. */extern svz_servertype_t irc_server_definition;/* these functions can be used by all of the IRC event subsections */int irc_client_in_channel (svz_socket_t *, irc_client_t *, irc_channel_t *);int irc_check_args (svz_socket_t *, irc_client_t *, irc_config_t *, 		    irc_request_t *, int);int irc_client_absent (irc_client_t *, irc_client_t *);int irc_printf __P ((svz_socket_t *, const char *, ...));/* serveez callbacks */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -