- Removed bopm_sockaddr and bopm_ircaddr structs
authormichael <michael@82007160-df01-0410-b94d-b575c5fd34c7>
Mon, 5 Jan 2015 19:27:13 +0000 (19:27 +0000)
committermichael <michael@82007160-df01-0410-b94d-b575c5fd34c7>
Mon, 5 Jan 2015 19:27:13 +0000 (19:27 +0000)
git-svn-id: svn://svn.ircd-hybrid.org/svnroot/hopm/branches/1.0.x@5312 82007160-df01-0410-b94d-b575c5fd34c7

src/irc.c
src/irc.h
src/negcache.c
src/scan.c

index 1712da453dedd4314dc2fc1d1b338423cf86579b..f4922ae4bc0fe6b1fcb391642682a0bff5652d4d 100644 (file)
--- a/src/irc.c
+++ b/src/irc.c
@@ -86,8 +86,8 @@ static char          IRC_RAW[MSGLENMAX];         /* Buffer to read data into
 static unsigned int  IRC_RAW_LEN    = 0;         /* Position of IRC_RAW                   */
 static int           IRC_FD         = 0;         /* File descriptor for IRC client        */
 
-static struct bopm_sockaddr IRC_SVR;             /* Sock Address Struct for IRC server    */
-static struct bopm_ircaddr  IRC_LOCAL;           /* Sock Address Struct for Bind          */
+static struct sockaddr_in IRC_SVR;              /* Sock Address Struct for IRC server    */
+static struct in_addr IRC_LOCAL;                /* Sock Address Struct for Bind          */
 
 static time_t IRC_LAST = 0;                      /* Last full line of data from irc server*/
 static time_t IRC_LASTRECONNECT = 0;             /* Time of last reconnection */
@@ -172,7 +172,7 @@ irc_cycle(void)
 static void
 irc_init(void)
 {
-  struct bopm_sockaddr bsaddr;
+  struct sockaddr_in bsaddr;
   struct in_addr *irc_host;
 
   if (IRC_FD)
@@ -180,7 +180,7 @@ irc_init(void)
 
   memset(&IRC_SVR, 0, sizeof(IRC_SVR));
   memset(&IRC_LOCAL, 0, sizeof(IRC_LOCAL));
-  memset(&bsaddr, 0, sizeof(struct bopm_sockaddr));
+  memset(&bsaddr, 0, sizeof(bsaddr));
 
   /* Resolve IRC host. */
   if ((irc_host = firedns_resolveip4(IRCItem->server)) == NULL)
@@ -190,11 +190,11 @@ irc_init(void)
     exit(EXIT_FAILURE);
   }
 
-  IRC_SVR.sa4.sin_family = AF_INET;
-  IRC_SVR.sa4.sin_port = htons(IRCItem->port);
-  IRC_SVR.sa4.sin_addr = *irc_host;
+  IRC_SVR.sin_family = AF_INET;
+  IRC_SVR.sin_port = htons(IRCItem->port);
+  IRC_SVR.sin_addr = *irc_host;
 
-  if (IRC_SVR.sa4.sin_addr.s_addr == INADDR_NONE)
+  if (IRC_SVR.sin_addr.s_addr == INADDR_NONE)
   {
     log_printf("IRC -> Unknown error resolving remote host (%s)",
                IRCItem->server);
@@ -215,17 +215,17 @@ irc_init(void)
   {
     int bindret = 0;
 
-    if (inet_pton(AF_INET, IRCItem->vhost, &(IRC_LOCAL.in4.s_addr)) <= 0)
+    if (inet_pton(AF_INET, IRCItem->vhost, &IRC_LOCAL.s_addr) <= 0)
     {
       log_printf("IRC -> bind(): %s is an invalid address", IRCItem->vhost);
       exit(EXIT_FAILURE);
     }
 
-    bsaddr.sa4.sin_addr.s_addr = IRC_LOCAL.in4.s_addr;
-    bsaddr.sa4.sin_family = AF_INET;
-    bsaddr.sa4.sin_port = htons(0);
+    bsaddr.sin_addr.s_addr = IRC_LOCAL.s_addr;
+    bsaddr.sin_family = AF_INET;
+    bsaddr.sin_port = htons(0);
 
-    bindret = bind(IRC_FD, (struct sockaddr *) &(bsaddr.sa4), sizeof(bsaddr.sa4));
+    bindret = bind(IRC_FD, (struct sockaddr *)&bsaddr, sizeof(bsaddr));
 
     if (bindret)
     {
index 0732832e3fa04b4cc409091e1daba748613794e5..a4be620a776f882a13500e67e59f51d4e6097f5b 100644 (file)
--- a/src/irc.h
+++ b/src/irc.h
@@ -2,23 +2,10 @@
 #define IRC_H
 
 #include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
 
 #define MSGLENMAX 512 + 1
 
 
-struct bopm_sockaddr
-{
-  struct sockaddr_in sa4;
-};
-
-struct bopm_ircaddr
-{
-  struct in_addr in4;
-};
-
 struct UserInfo
 {
   char *irc_nick;
index f77bc7902fad1cdd0b809e3ef18a15b272770121..55c521e5ab134131c08bf5cdc0521cd47a5e1061 100644 (file)
@@ -44,6 +44,10 @@ along with this program; if not, write to:
 #include <stdlib.h>
 #include <sys/time.h>
 #include <time.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
 
 #include "irc.h"
 #include "negcache.h"
@@ -195,16 +199,16 @@ struct cnode *check_neg_cache(const unsigned long ip)
  */
 void negcache_insert(const char *ipstr)
 {
-   struct bopm_sockaddr ip;
+   struct sockaddr_in ip;
    struct cnode *n;
 
-   if (inet_pton(AF_INET, ipstr, &(ip.sa4.sin_addr)) <= 0)
+   if (inet_pton(AF_INET, ipstr, &ip.sin_addr) <= 0)
    {
       log_printf("NEGCACHE -> Invalid IPv4 address '%s'", ipstr);
       return;
    }
 
-   n = nc_insert(nc_head, ip.sa4.sin_addr.s_addr);
+   n = nc_insert(nc_head, ip.sin_addr.s_addr);
 
    if (n)
       n->seen = time(NULL);
index f2459c8a6cfea4fc818ae6953bc60e20476de7c8..dbc1934100cdd9b8033fd581f5bf6f18a68b5c58 100644 (file)
@@ -33,6 +33,9 @@
 #include <errno.h>
 #include <fcntl.h>
 #include <poll.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
 
 #include "compat.h"
 #include "config.h"
@@ -305,7 +308,7 @@ scan_init(void)
 void
 scan_connect(char **user, char *msg)
 {
-  struct bopm_sockaddr ip;
+  struct sockaddr_in ip;
   node_t *p, *p2;
   struct scan_struct *ss;
   struct scanner_struct *scs;
@@ -323,14 +326,14 @@ scan_connect(char **user, char *msg)
   /* Check negcache before anything */
   if (OptionsItem->negcache > 0)
   {
-    if (inet_pton(AF_INET, user[3], &(ip.sa4.sin_addr)) <= 0)
+    if (inet_pton(AF_INET, user[3], &ip.sin_addr) <= 0)
     {
       log_printf("SCAN -> Invalid IPv4 address '%s'!", user[3]);
       return;
     }
     else
     {
-      if (check_neg_cache(ip.sa4.sin_addr.s_addr))
+      if (check_neg_cache(ip.sin_addr.s_addr))
       {
         if (OPT_DEBUG)
           log_printf("SCAN -> %s!%s@%s (%s) is negatively cached. "