diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2003-02-02 16:43:53 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2003-02-02 16:43:53 +0000 |
commit | 8cc90ca14d84ef8ec83989de45854a2c7855ee4f (patch) | |
tree | 771a440c41b57f043119decee41e4fcaac3ba12a /src | |
parent | 6e442fdbe3e2bebea9049399163698f4a892f685 (diff) |
Added first part of server linking code
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@160 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r-- | src/InspIRCd.dev | 6 | ||||
-rw-r--r-- | src/InspIRCd.layout | 66 | ||||
-rw-r--r-- | src/Makefile.FreeBSD | 2 | ||||
-rw-r--r-- | src/Makefile.Linux | 2 | ||||
-rw-r--r-- | src/inspircd.cpp | 58 | ||||
-rw-r--r-- | src/inspircd_io.cpp | 7 | ||||
-rw-r--r-- | src/servers.cpp | 23 | ||||
-rwxr-xr-x | src/version.sh | 2 |
8 files changed, 91 insertions, 75 deletions
diff --git a/src/InspIRCd.dev b/src/InspIRCd.dev index 7dd7af93e..158897e8b 100644 --- a/src/InspIRCd.dev +++ b/src/InspIRCd.dev @@ -1,7 +1,7 @@ [Project] FileName=InspIRCd.dev Name=InspIRCd -UnitCount=24 +UnitCount=25 Type=1 Ver=1 ObjFiles= @@ -212,8 +212,8 @@ OverrideBuildCmd=0 BuildCmd= [Unit25] -FileName=..\include\base.h -Folder=Headers +FileName=N:\inspircd-cvs\inspircd\src\connection.cpp +Folder=Source Compile=1 CompileCpp=1 OverrideBuildCmd=0 diff --git a/src/InspIRCd.layout b/src/InspIRCd.layout index 322dca836..a9ffae4f7 100644 --- a/src/InspIRCd.layout +++ b/src/InspIRCd.layout @@ -1,10 +1,10 @@ [Editors] -Focused=0 -Order=-1,7,1,2,3,4,5,6,0 +Focused=1 +Order=7,1,2,3,4,5,6,0,-1 [Editor_0] Open=1 -Top=1 +Top=0 CursorCol=1 CursorRow=1 TopLine=1 @@ -12,18 +12,18 @@ LeftChar=1 [Editor_1] Open=1 -Top=0 +Top=1 CursorCol=1 -CursorRow=1 -TopLine=1 +CursorRow=3977 +TopLine=3952 LeftChar=1 [Editor_2] Open=1 Top=0 CursorCol=1 -CursorRow=1 -TopLine=1 +CursorRow=56 +TopLine=36 LeftChar=1 [Editor_3] @@ -38,7 +38,7 @@ LeftChar=1 Open=1 Top=0 CursorCol=1 -CursorRow=3 +CursorRow=33 TopLine=1 LeftChar=1 @@ -46,7 +46,7 @@ LeftChar=1 Open=1 Top=0 CursorCol=1 -CursorRow=3 +CursorRow=40 TopLine=1 LeftChar=1 @@ -67,7 +67,7 @@ TopLine=1 LeftChar=1 [Editor_8] -Open=1 +Open=0 Top=0 CursorCol=1 CursorRow=1 @@ -75,7 +75,7 @@ TopLine=1 LeftChar=1 [Editor_9] -Open=1 +Open=0 Top=0 CursorCol=1 CursorRow=1 @@ -83,7 +83,7 @@ TopLine=1 LeftChar=1 [Editor_10] -Open=1 +Open=0 Top=0 CursorCol=1 CursorRow=1 @@ -91,7 +91,7 @@ TopLine=1 LeftChar=1 [Editor_11] -Open=1 +Open=0 Top=0 CursorCol=1 CursorRow=1 @@ -102,7 +102,7 @@ LeftChar=1 Open=1 Top=0 CursorCol=1 -CursorRow=3 +CursorRow=1 TopLine=1 LeftChar=1 @@ -110,12 +110,12 @@ LeftChar=1 Open=1 Top=0 CursorCol=1 -CursorRow=3 -TopLine=1 +CursorRow=60 +TopLine=27 LeftChar=1 [Editor_14] -Open=1 +Open=0 Top=0 CursorCol=1 CursorRow=1 @@ -123,7 +123,7 @@ TopLine=1 LeftChar=1 [Editor_15] -Open=1 +Open=0 Top=0 CursorCol=1 CursorRow=3 @@ -131,7 +131,7 @@ TopLine=1 LeftChar=1 [Editor_16] -Open=1 +Open=0 Top=0 CursorCol=1 CursorRow=3 @@ -142,28 +142,28 @@ LeftChar=1 Open=1 Top=0 CursorCol=1 -CursorRow=3 -TopLine=1 +CursorRow=72 +TopLine=32 LeftChar=1 [Editor_18] -Open=1 +Open=0 Top=0 CursorCol=1 -CursorRow=14 +CursorRow=1 TopLine=1 LeftChar=1 [Editor_19] -Open=1 +Open=0 Top=0 CursorCol=1 -CursorRow=3 +CursorRow=1 TopLine=1 LeftChar=1 [Editor_20] -Open=1 +Open=0 Top=0 CursorCol=1 CursorRow=1 @@ -174,12 +174,12 @@ LeftChar=1 Open=1 Top=0 CursorCol=1 -CursorRow=3 +CursorRow=29 TopLine=1 LeftChar=1 [Editor_22] -Open=1 +Open=0 Top=0 CursorCol=1 CursorRow=1 @@ -187,7 +187,7 @@ TopLine=1 LeftChar=1 [Editor_23] -Open=1 +Open=0 Top=0 CursorCol=1 CursorRow=3 @@ -195,5 +195,9 @@ TopLine=1 LeftChar=1 [Editor_24] -Open=0 +Open=1 Top=0 +CursorCol=1 +CursorRow=63 +TopLine=42 +LeftChar=1 diff --git a/src/Makefile.FreeBSD b/src/Makefile.FreeBSD index 755f3c7ff..8e8bdce4d 100644 --- a/src/Makefile.FreeBSD +++ b/src/Makefile.FreeBSD @@ -7,7 +7,7 @@ CC = im a cheezeball -SRC_1 = inspircd.cpp inspircd_util.cpp inspircd_io.cpp +SRC_1 = inspircd.cpp inspircd_util.cpp inspircd_io.cpp connection.cpp SRC_2 = dynamic.cpp users.cpp modules.cpp wildcard.cpp servers.cpp SRC = $(SRC_1) $(SRC_2) diff --git a/src/Makefile.Linux b/src/Makefile.Linux index 755f3c7ff..8e8bdce4d 100644 --- a/src/Makefile.Linux +++ b/src/Makefile.Linux @@ -7,7 +7,7 @@ CC = im a cheezeball -SRC_1 = inspircd.cpp inspircd_util.cpp inspircd_io.cpp +SRC_1 = inspircd.cpp inspircd_util.cpp inspircd_io.cpp connection.cpp SRC_2 = dynamic.cpp users.cpp modules.cpp wildcard.cpp servers.cpp SRC = $(SRC_1) $(SRC_2) diff --git a/src/inspircd.cpp b/src/inspircd.cpp index ac8a46c1f..33fa511c2 100644 --- a/src/inspircd.cpp +++ b/src/inspircd.cpp @@ -125,10 +125,12 @@ typedef hash_map<in_addr,string*, hash<in_addr>, InAddr_HashComp> address_cache; typedef deque<command_t> command_table; typedef DLLFactory<ModuleFactory> ircd_module; +serverrec* me; +server_list* servers; + user_hash clientlist; chan_hash chanlist; user_hash whowas; -server_list servers; command_table cmdlist; file_cache MOTD; file_cache RULES; @@ -199,6 +201,11 @@ string getservername() return ServerName; } +string getserverdesc() +{ + return ServerDesc; +} + string getnetworkname() { return Network; @@ -3437,6 +3444,11 @@ void handle_stats(char **parameters, int pcnt, userrec *user) void handle_connect(char **parameters, int pcnt, userrec *user) { + WriteServ(user->fd,"NOTICE %s :*** Connecting to %s port 7000...",user->nick,parameters[0]); + if (!me->BeginLink(parameters[0],7000,"password")) + { + WriteServ(user->fd,"NOTICE %s :*** Failed to send auth packet to %s!",user->nick,parameters[0]); + } } void handle_squit(char **parameters, int pcnt, userrec *user) @@ -3962,6 +3974,12 @@ int InspIRCd(void) MODCOUNT = count - 1; debug("Total loaded modules: %d",MODCOUNT+1); + me = new serverrec(ServerName,100L,false); + servers = new server_list; + servers->clear(); + + me->CreateListener("127.0.0.1",7000); + printf("\nInspIRCd is now running!\n"); startup_time = time(NULL); @@ -4005,7 +4023,8 @@ int InspIRCd(void) } length = sizeof (client); - int flip_flop = 0; + int flip_flop = 0, udp_port = 0; + char udp_msg[MAXBUF], udp_host[MAXBUF]; /* main loop for multiplexing/resetting */ for (;;) @@ -4029,6 +4048,11 @@ int InspIRCd(void) tv.tv_sec = 0; selectResult = select(MAXSOCKS, &selectFds, NULL, NULL, &tv); + if (me->RecvPacket(udp_msg, udp_host, udp_port)) + { + WriteOpers("UDP Link Packet: '%s' from %s:%d",udp_msg,udp_host,udp_port); + } + for (user_hash::iterator count2 = clientlist.begin(); count2 != clientlist.end(); count2++) { char data[MAXBUF]; @@ -4085,38 +4109,38 @@ int InspIRCd(void) if (selectResult > 0) { char target[MAXBUF], resolved[MAXBUF]; - for (count = 0; count < boundPortCount; count++) + for (count = 0; count < boundPortCount; count++) { if (FD_ISSET (openSockfd[count], &selectFds)) { incomingSockfd = accept (openSockfd[count], (struct sockaddr *) &client, &length); address_cache::iterator iter = IP.find(client.sin_addr); - bool iscached = false; + bool iscached = false; if (iter == IP.end()) { /* ip isn't in cache, add it */ strncpy (target, (char *) inet_ntoa (client.sin_addr), MAXBUF); - if(CleanAndResolve(resolved, target) != TRUE) - { - strncpy(resolved,target,MAXBUF); - } + if(CleanAndResolve(resolved, target) != TRUE) + { + strncpy(resolved,target,MAXBUF); + } /* hostname now in 'target' */ IP[client.sin_addr] = new string(resolved); - /* hostname in cache */ + /* hostname in cache */ } else { - /* found ip (cached) */ - strncpy(resolved, iter->second->c_str(), MAXBUF); - iscached = true; - } + /* found ip (cached) */ + strncpy(resolved, iter->second->c_str(), MAXBUF); + iscached = true; + } if (incomingSockfd < 0) { - WriteOpers("*** WARNING: Accept failed on port %d (%s)", ports[count],target); - debug("InspIRCd: accept failed: %d",ports[count]); - break; + WriteOpers("*** WARNING: Accept failed on port %d (%s)", ports[count],target); + debug("InspIRCd: accept failed: %d",ports[count]); + break; } AddClient(incomingSockfd, resolved, ports[count], iscached); @@ -4124,7 +4148,7 @@ int InspIRCd(void) break; } - } + } } } diff --git a/src/inspircd_io.cpp b/src/inspircd_io.cpp index d561a9c38..6e36de477 100644 --- a/src/inspircd_io.cpp +++ b/src/inspircd_io.cpp @@ -51,12 +51,17 @@ void Start (void) } +void DeadPipe(int status) +{ + signal (SIGPIPE, DeadPipe); +} + int DaemonSeed (void) { int childpid; signal (SIGALRM, SIG_IGN); signal (SIGHUP, Rehash); - signal (SIGPIPE, SIG_IGN); + signal (SIGPIPE, DeadPipe); signal (SIGTERM, Exit); signal (SIGABRT, Exit); signal (SIGSEGV, Error); diff --git a/src/servers.cpp b/src/servers.cpp index 98da2264c..2affa9a94 100644 --- a/src/servers.cpp +++ b/src/servers.cpp @@ -11,14 +11,12 @@ serverrec::serverrec() { - leaf.clear(); strcpy(name,""); pingtime = 0; - linktype = LINK_ACTIVE; lastping = time(NULL); usercount_i = usercount = opercount = version = 0; hops_away = 1; - connected_at = time(NULL); + signon = time(NULL); jupiter = false; fd = 0; } @@ -28,30 +26,15 @@ serverrec::~serverrec() { } -serverrec::serverrec(char* n, int link_t, long ver, bool jupe) +serverrec::serverrec(char* n, long ver, bool jupe) { - leaf.clear(); strcpy(name,n); - linktype = link_t; lastping = time(NULL); usercount_i = usercount = opercount = 0; version = ver; hops_away = 1; - connected_at = time(NULL); + signon = time(NULL); jupiter = jupe; fd = 0; } -void serverrec::AddLeaf(serverrec *child) -{ - leaf[child->name] = child; -} - -void serverrec::DelLeaf(string n) -{ - server_list::iterator i = leaf.find(n); - - if (i != leaf.end()) - leaf.erase(i); -} - diff --git a/src/version.sh b/src/version.sh index 14b08aa61..216b9e821 100755 --- a/src/version.sh +++ b/src/version.sh @@ -1,2 +1,2 @@ #!sh -echo "InspIRCd-1.0[Alpha9]" +echo "InspIRCd-1.0[Alpha10]" |