added some files
authorpk910 <philipp@zoelle1.de>
Sun, 20 Jul 2014 17:32:46 +0000 (19:32 +0200)
committerpk910 <philipp@zoelle1.de>
Sun, 20 Jul 2014 17:32:46 +0000 (19:32 +0200)
src/cmd.h [new file with mode: 0644]
src/cmd_nick.c [new file with mode: 0644]
src/crypt_md5.h
src/ircd_nicks.c [new file with mode: 0644]
src/ircd_parse.c
src/ircd_users.c [new file with mode: 0644]
src/struct_auth.h
src/struct_channel.h [new file with mode: 0644]
src/struct_client.h [new file with mode: 0644]
src/struct_member.h [new file with mode: 0644]
src/struct_user.h [new file with mode: 0644]

diff --git a/src/cmd.h b/src/cmd.h
new file mode 100644 (file)
index 0000000..a2896a4
--- /dev/null
+++ b/src/cmd.h
@@ -0,0 +1,30 @@
+/* cmd.h - NextIRCd
+ * Copyright (C) 2012-2013  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 <http://www.gnu.org/licenses/>. 
+ */
+
+#ifndef _cmd_h
+#define _cmd_h
+
+struct Client;
+struct Auth;
+struct Server;
+
+
+int cmd_nick_cli(struct Client *client, char *argv[], int argc);
+int cmd_nick_auth(struct Auth *auth, char *argv[], int argc);
+
+
+#endif
diff --git a/src/cmd_nick.c b/src/cmd_nick.c
new file mode 100644 (file)
index 0000000..effb22f
--- /dev/null
@@ -0,0 +1,29 @@
+/* cmd_nick.c - NextIRCd
+ * Copyright (C) 2012-2013  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 <http://www.gnu.org/licenses/>. 
+ */
+
+#include "cmd.h"
+#include "struct_auth.h"
+
+int cmd_nick_cli(struct Client *client, char *argv[], int argc) {
+       
+       return 0;
+}
+
+int cmd_nick_auth(struct Auth *auth, char *argv[], int argc) {
+       
+       return 0;
+}
index e926e37b659a85f5ca02d50b9b824944b3d330bd..2b04665a30efff67b5c666dc20c3b4e08aca8929 100644 (file)
@@ -18,6 +18,8 @@
 #ifndef _crypt_md5_h
 #define _crypt_md5_h
 
+#define MDHASHLEN 16
+
 unsigned char *crypt_md5_bin(const char *str, int strlen);
 
 #endif
diff --git a/src/ircd_nicks.c b/src/ircd_nicks.c
new file mode 100644 (file)
index 0000000..5b64ad2
--- /dev/null
@@ -0,0 +1,29 @@
+/* ircd_nicks.c - NextIRCd
+ * Copyright (C) 2012-2013  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 <http://www.gnu.org/licenses/>. 
+ */
+#include "struct_user.h"
+
+struct UserDictEntry {
+       struct User *user;
+       struct UserDict *next, *prev;
+};
+
+struct UserDict {
+       struct UserDictEntry *users[65536]; // 2^16  (first 16 bit of nickhash as identifier)
+};
+
+
+
index 392459b852cfab4c594bc06873f5f2836899e026..21197b1fbf2915b27db467845ad238b12c7de70c 100644 (file)
@@ -60,6 +60,21 @@ struct {
                {NULL, 0, 1, 0}, /* Unauthed */
                {NULL, 0, 1, 0}  /* Server */
        },
+       {{"PASS", NULL}, /* PASS Command */
+               {NULL, 0, 1, 0}, /* Client */
+               {NULL, 0, 1, 0}, /* Unauthed */
+               {NULL, 0, 1, 0}  /* Server */
+       },
+       {{"NICK", "N"}, /* Nick Command */
+               {cmd_nick_cli, 0, 1, 0}, /* Client */
+               {cmd_nick_auth, 0, 1, 0}, /* Unauthed */
+               {NULL, 0, 1, 0}  /* Server */
+       },
+       {{"USER", "U"}, /* User Command */
+               {NULL, 0, 1, 0}, /* Client */
+               {NULL, 0, 1, 0}, /* Unauthed */
+               {NULL, 0, 1, 0}  /* Server */
+       },
        
        {{NULL, NULL},{NULL, 0, 0, 0},{NULL, 0, 0, 0},{NULL, 0, 0, 0}}
 };
diff --git a/src/ircd_users.c b/src/ircd_users.c
new file mode 100644 (file)
index 0000000..ef0bc82
--- /dev/null
@@ -0,0 +1,34 @@
+/* ircd_users.c - NextIRCd
+ * Copyright (C) 2012-2013  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 <http://www.gnu.org/licenses/>. 
+ */
+#include "struct_user.h"
+
+struct UserDictEntry {
+       struct User *user;
+       time_t lastaccess;
+       struct UserDict *next, *prev;
+};
+
+struct UserDict {
+       struct UserDictEntry *users[65536]; // 2^16  (first 16 bit of nickhash as identifier)
+};
+
+
+void find_user_by_nick(char *nick) {
+       //calculate checksum
+       //search in UserDict
+       //ask trusted server multicast
+}
index 3a0147cdf132ff895015b61c257d823b03a3b225..69a452af43f958a9a76fbc27dd38472b356c3194 100644 (file)
 
 struct Auth {
     struct Connection *conn;
-    
+       
     char *nick;
     char *ident;
     char *realname;
     char *passwd;
     
     unsigned int ping_number;
-    unsigned int server : 1;
+    
+       unsigned int server : 1;
+       unsigned int have_nick : 1;
+       unsigned int have_user : 1;
+       unsigned int have_pass : 1;
     
 };
 
diff --git a/src/struct_channel.h b/src/struct_channel.h
new file mode 100644 (file)
index 0000000..a5c028b
--- /dev/null
@@ -0,0 +1,34 @@
+/* struct_channel.h - NextIRCd
+ * Copyright (C) 2012-2013  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 <http://www.gnu.org/licenses/>. 
+ */
+
+#ifndef _struct_channel_h
+#define _struct_channel_h
+#include "crypto_md5.h"
+
+#define NAMELEN  200
+#define TOPICLEN 500
+#define HOSTLEN  63
+#define REALLEN  50
+
+struct Channel {
+       char name[NAMELEN+1];
+       char namehash[MDHASHLEN];
+       
+       struct Member *users;
+};
+
+#endif
diff --git a/src/struct_client.h b/src/struct_client.h
new file mode 100644 (file)
index 0000000..537b832
--- /dev/null
@@ -0,0 +1,58 @@
+/* struct_client.h - NextIRCd
+ * Copyright (C) 2012-2013  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 <http://www.gnu.org/licenses/>. 
+ */
+
+#ifndef _struct_client_h
+#define _struct_client_h
+#include "crypto_md5.h"
+#include "struct_user.h"
+
+struct Connection;
+struct User;
+
+struct ClientNickChange;
+
+#define AWAYLEN  300
+
+/* Client represents a local User */
+struct Client {
+    struct Connection *conn;
+       struct User *user;
+       
+       struct ClientNickChange *nickchange;
+       
+       time_t userage;
+       time_t nickage;
+       time_t lastping;
+       time_t idlelen;
+    
+       char *userage_sign;
+       char *nickage_sign;
+       
+       char awaymsg[AWAYLEN-1];
+       
+       unsigned int isonline : 1;
+       unsigned int isaway : 1;
+       
+       struct Client *prev, *next
+};
+
+struct ClientNickChange {
+       char newnick[NICKLEN+1];
+       char nickhash[MDHASHLEN];
+};
+
+#endif
diff --git a/src/struct_member.h b/src/struct_member.h
new file mode 100644 (file)
index 0000000..3f723fc
--- /dev/null
@@ -0,0 +1,41 @@
+/* struct_member.h - NextIRCd
+ * Copyright (C) 2012-2013  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 <http://www.gnu.org/licenses/>. 
+ */
+
+#ifndef _struct_member_h
+#define _struct_member_h
+
+struct Channel;
+struct User;
+struct Server;
+
+struct Member {
+       struct Channel *chan;
+       union {
+               struct User *user;
+               struct Server *server;
+       } user;
+       
+       unsigned int isserver : 1;
+       unsigned int isowner : 1;
+       unsigned int hasop : 1;
+       unsigned int hasvoice : 1;
+       
+       struct Member *prev_user, *next_user;
+       struct Member *prev_chan, *next_chan;
+};
+
+#endif
diff --git a/src/struct_user.h b/src/struct_user.h
new file mode 100644 (file)
index 0000000..47f722d
--- /dev/null
@@ -0,0 +1,44 @@
+/* struct_user.h - NextIRCd
+ * Copyright (C) 2012-2013  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 <http://www.gnu.org/licenses/>. 
+ */
+
+#ifndef _struct_user_h
+#define _struct_user_h
+#include "crypto_md5.h"
+
+#define NICKLEN  30
+#define IDENTLEN 15
+#define HOSTLEN  63
+#define REALLEN  50
+
+struct User {
+    unsigned int usernum;
+       unsigned int servernum;
+       
+       struct Server *server;
+       
+       unsigned int islocal : 1;
+       
+       char nick[NICKLEN+1];
+       char nickhash[MDHASHLEN];
+       char ident[IDENTLEN+1];
+       char realname[REALLEN+1];
+       char hostname[HOSTLEN+1];
+       
+       struct Member *channels;
+};
+
+#endif