]> jfr.im git - irc/ircd-hybrid/libopm.git/commitdiff
Prefixed functions in libopm.c and list.c with libopm_
authorstrtok <redacted>
Sat, 21 Sep 2002 01:42:51 +0000 (01:42 +0000)
committerstrtok <redacted>
Sat, 21 Sep 2002 01:42:51 +0000 (01:42 +0000)
Made certain functions (which should be) static

src/libopm.c
src/libopm.h
src/list.c
src/list.h
src/opm.h
src/opm_common.h

index b8f3b7f3c4955f764fee7cb41f1b9de36d083b8d..22b51ca2280a65e141273163742012970579080b 100644 (file)
 
 RCSID("$Id$");
 
-OPM_PROTOCOL_CONFIG_T *protocol_config_create();
-void protocol_config_free(OPM_PROTOCOL_CONFIG_T *);
+static OPM_PROTOCOL_CONFIG_T *libopm_protocol_config_create();
+static void libopm_protocol_config_free(OPM_PROTOCOL_CONFIG_T *);
 
-OPM_SCAN_T *scan_create(OPM_T *, OPM_REMOTE_T *);
-void scan_free(OPM_SCAN_T *);
+static OPM_SCAN_T *libopm_scan_create(OPM_T *, OPM_REMOTE_T *);
+static void libopm_scan_free(OPM_SCAN_T *);
 
-OPM_CONNECTION_T *connection_create();
-void connection_free(OPM_CONNECTION_T *);
+static OPM_CONNECTION_T *libopm_connection_create();
+static void libopm_connection_free(OPM_CONNECTION_T *);
 
-void check_establish(OPM_T *);
-void check_poll(OPM_T *);
-void check_closed(OPM_T *);
-void check_queue(OPM_T *);
+static void libopm_check_establish(OPM_T *);
+static void libopm_check_poll(OPM_T *);
+static void libopm_check_closed(OPM_T *);
+static void libopm_check_queue(OPM_T *);
 
-void do_connect(OPM_T *, OPM_SCAN_T *, OPM_CONNECTION_T *);
-void do_readready(OPM_T *, OPM_SCAN_T *, OPM_CONNECTION_T *);
-void do_writeready(OPM_T *, OPM_SCAN_T *, OPM_CONNECTION_T *);
-void do_hup(OPM_T *, OPM_SCAN_T *, OPM_CONNECTION_T *);
-void do_read(OPM_T *, OPM_SCAN_T *, OPM_CONNECTION_T *);
-void do_openproxy(OPM_T *, OPM_SCAN_T *, OPM_CONNECTION_T *);
+static void libopm_do_connect(OPM_T *, OPM_SCAN_T *, OPM_CONNECTION_T *);
+static void libopm_do_readready(OPM_T *, OPM_SCAN_T *, OPM_CONNECTION_T *);
+static void libopm_do_writeready(OPM_T *, OPM_SCAN_T *, OPM_CONNECTION_T *);
+static void libopm_do_hup(OPM_T *, OPM_SCAN_T *, OPM_CONNECTION_T *);
+static void libopm_do_read(OPM_T *, OPM_SCAN_T *, OPM_CONNECTION_T *);
+static void libopm_do_openproxy(OPM_T *, OPM_SCAN_T *, OPM_CONNECTION_T *);
 
-void do_callback(OPM_T *, OPM_REMOTE_T *, int, int);
+static void libopm_do_callback(OPM_T *, OPM_REMOTE_T *, int, int);
 
-OPM_REMOTE_T *setup_remote(OPM_REMOTE_T *remote, OPM_CONNECTION_T *conn);
+static OPM_REMOTE_T *libopm_setup_remote(OPM_REMOTE_T *remote, OPM_CONNECTION_T *conn);
 
 /* OPM_PROTOCOLS hash
  *
@@ -80,7 +80,7 @@ OPM_REMOTE_T *setup_remote(OPM_REMOTE_T *remote, OPM_CONNECTION_T *conn);
  *
  */
 
-OPM_PROTOCOL_T OPM_PROTOCOLS[] = {
+static OPM_PROTOCOL_T OPM_PROTOCOLS[] = {
     {OPM_TYPE_HTTP,               proxy_http_write,    NULL},
     {OPM_TYPE_SOCKS4,             proxy_socks4_write,  NULL},
     {OPM_TYPE_SOCKS5,             proxy_socks5_write,  NULL},
@@ -110,9 +110,9 @@ OPM_T *opm_create()
    ret = MyMalloc(sizeof(OPM_T));
 
    ret->config = libopm_config_create();
-   ret->scans = list_create();
-   ret->queue = list_create();
-   ret->protocols = list_create();
+   ret->scans = libopm_list_create();
+   ret->queue = libopm_list_create();
+   ret->protocols = libopm_list_create();
    ret->fd_use = 0;
 
    /* Setup callbacks */
@@ -155,6 +155,7 @@ OPM_REMOTE_T *opm_remote_create(char *ip)
  
    /* Setup callbacks */
    ret->callbacks = MyMalloc(sizeof(OPM_CALLBACK_T *) * CBLEN);
+
    for(i = 0; i < CBLEN; i++)
       ret->callbacks[i] = NULL;   
 
@@ -188,7 +189,6 @@ OPM_REMOTE_T *opm_remote_create(char *ip)
 
 void opm_remote_free(OPM_REMOTE_T *remote)
 {
-   int i;
 
    MyFree(remote->callbacks);
 
@@ -261,8 +261,8 @@ OPM_ERR_T opm_callback(OPM_T *scanner, int type, OPM_CALLBACK_T *function)
 void opm_free(OPM_T *scanner)
 {
    int i;
-   node_t *p, *next;
 
+   OPM_NODE_T *p, *next;
    OPM_PROTOCOL_CONFIG_T *ppc;
    OPM_SCAN_T *scan;
 
@@ -271,30 +271,30 @@ void opm_free(OPM_T *scanner)
    LIST_FOREACH_SAFE(p, next, scanner->protocols->head)
    {
       ppc = (OPM_PROTOCOL_CONFIG_T *) p->data;
-      protocol_config_free(ppc);
-      list_remove(scanner->protocols, p);
-      node_free(p);
+      libopm_protocol_config_free(ppc);
+      libopm_list_remove(scanner->protocols, p);
+      libopm_node_free(p);
    }
 
    LIST_FOREACH_SAFE(p, next, scanner->scans->head)
    {
       scan = (OPM_SCAN_T *) p->data;
-      scan_free(scan);
-      list_remove(scanner->scans, p);
-      node_free(p);
+      libopm_scan_free(scan);
+      libopm_list_remove(scanner->scans, p);
+      libopm_node_free(p);
    }
 
    LIST_FOREACH_SAFE(p, next, scanner->queue->head)
    {
       scan = (OPM_SCAN_T *) p->data;
-      scan_free(scan);
-      list_remove(scanner->queue, p);
-      node_free(p);
+      libopm_scan_free(scan);
+      libopm_list_remove(scanner->queue, p);
+      libopm_node_free(p);
    }
 
-   list_free(scanner->protocols);
-   list_free(scanner->scans);
-   list_free(scanner->queue);
+   libopm_list_free(scanner->protocols);
+   libopm_list_free(scanner->scans);
+   libopm_list_free(scanner->queue);
 
    MyFree(scanner->callbacks);
    MyFree(scanner);
@@ -341,20 +341,21 @@ OPM_ERR_T opm_config(OPM_T *scanner, int key, void *value)
 OPM_ERR_T opm_addtype(OPM_T *scanner, int type, int port)
 {
    int i;
-   node_t *node;
+
+   OPM_NODE_T *node;
    OPM_PROTOCOL_CONFIG_T *protocol;
 
    for(i = 0; i < sizeof(OPM_PROTOCOLS) / sizeof(OPM_PROTOCOL_T); i++)
    {
       if(type == OPM_PROTOCOLS[i].type)
       {
-         protocol = protocol_config_create();
+         protocol = libopm_protocol_config_create();
 
          protocol->type = &OPM_PROTOCOLS[i];
          protocol->port = port;
   
-         node = node_create(protocol);
-         list_add(scanner->protocols, node);
+         node = libopm_node_create(protocol);
+         libopm_list_add(scanner->protocols, node);
 
          return OPM_SUCCESS;
 
@@ -377,7 +378,7 @@ OPM_ERR_T opm_addtype(OPM_T *scanner, int type, int port)
  *    Address of new OPM_PROTOCOL_CONFIG_T
  */
 
-OPM_PROTOCOL_CONFIG_T *protocol_config_create()
+OPM_PROTOCOL_CONFIG_T *libopm_protocol_config_create()
 {
    OPM_PROTOCOL_CONFIG_T *ret;
    ret = MyMalloc(sizeof(OPM_PROTOCOL_CONFIG_T));
@@ -399,7 +400,7 @@ OPM_PROTOCOL_CONFIG_T *protocol_config_create()
  *    None
  */
 
-void protocol_config_free(OPM_PROTOCOL_CONFIG_T *protocol)
+static void libopm_protocol_config_free(OPM_PROTOCOL_CONFIG_T *protocol)
 {
    MyFree(protocol);
 }
@@ -424,16 +425,16 @@ void protocol_config_free(OPM_PROTOCOL_CONFIG_T *protocol)
 OPM_ERR_T opm_scan(OPM_T *scanner, OPM_REMOTE_T *remote)
 {
    OPM_SCAN_T *scan; /* New scan for OPM_T */
-   node_t *node;     /* Node we'll add scan to
+   OPM_NODE_T *node;     /* Node we'll add scan to
                         when we link it to scans */
    unsigned int fd_limit;
 
    fd_limit = *(int *) libopm_config(scanner->config, OPM_CONFIG_FD_LIMIT);
 
-   scan = scan_create(scanner, remote);
-   node = node_create(scan);
+   scan = libopm_scan_create(scanner, remote);
+   node = libopm_node_create(scan);
 
-   list_add(scanner->queue, node);
+   libopm_list_add(scanner->queue, node);
 
    return OPM_SUCCESS;
 }
@@ -454,29 +455,28 @@ OPM_ERR_T opm_scan(OPM_T *scanner, OPM_REMOTE_T *remote)
  * Return
  *    Address of new struct
  */
-OPM_SCAN_T *scan_create(OPM_T *scanner, OPM_REMOTE_T *remote)
+static OPM_SCAN_T *libopm_scan_create(OPM_T *scanner, OPM_REMOTE_T *remote)
 {
    OPM_SCAN_T *ret;
-
    OPM_CONNECTION_T *conn;
-   node_t *node, *p;
+   OPM_NODE_T *node, *p;
 
    ret = MyMalloc(sizeof(OPM_SCAN_T));
 
    ret->remote = remote;
-   ret->connections = list_create();
+   ret->connections = libopm_list_create();
  
    /* Setup list of connections, one for each protocol */ 
    LIST_FOREACH(p, scanner->protocols->head)
    {
-      conn = connection_create();
+      conn = libopm_connection_create();
 
       conn->protocol = ((OPM_PROTOCOL_CONFIG_T *) p->data)->type;
       conn->port     = ((OPM_PROTOCOL_CONFIG_T *) p->data)->port;
  
-      node = node_create(conn);
+      node = libopm_node_create(conn);
 
-      list_add(ret->connections, node);
+      libopm_list_add(ret->connections, node);
    }
 
    
@@ -497,20 +497,20 @@ OPM_SCAN_T *scan_create(OPM_T *scanner, OPM_REMOTE_T *remote)
  *    None
  */
 
-void scan_free(OPM_SCAN_T *scan)
+static void libopm_scan_free(OPM_SCAN_T *scan)
 {
-   node_t *p, *next;
+   OPM_NODE_T *p, *next;
    OPM_CONNECTION_T *conn;
 
    LIST_FOREACH_SAFE(p, next, scan->connections->head)
    {
       conn = (OPM_CONNECTION_T *) p->data;
-      connection_free(conn);
+      libopm_connection_free(conn);
 
-      list_remove(scan->connections, p);
-      node_free(p);
+      libopm_list_remove(scan->connections, p);
+      libopm_node_free(p);
    }
-   list_free(scan->connections);
+   libopm_list_free(scan->connections);
 
    MyFree(scan);
 }
@@ -529,7 +529,7 @@ void scan_free(OPM_SCAN_T *scan)
  *    Address of new OPM_CONNECTION_T
  */
 
-OPM_CONNECTION_T *connection_create()
+static OPM_CONNECTION_T *libopm_connection_create()
 {
    OPM_CONNECTION_T *ret;
    ret = MyMalloc(sizeof(OPM_CONNECTION_T));
@@ -542,7 +542,6 @@ OPM_CONNECTION_T *connection_create()
 
    ret->state      = OPM_STATE_UNESTABLISHED;
 
-
    return ret;
 }
 
@@ -560,7 +559,7 @@ OPM_CONNECTION_T *connection_create()
  *    None
  */
 
-void connection_free(OPM_CONNECTION_T *conn)
+static void libopm_connection_free(OPM_CONNECTION_T *conn)
 {
    MyFree(conn);
 }
@@ -578,10 +577,10 @@ void connection_free(OPM_CONNECTION_T *conn)
 
 void opm_cycle(OPM_T *scanner)
 {
-   check_establish(scanner);  /* Make new connections if possible                */
-   check_poll(scanner);       /* Poll connections for IO  and proxy test         */
-   check_closed(scanner);     /* Check for closed or timed out connections       */
-   check_queue(scanner);      /* Move scans from the queue to the live scan list */
+   libopm_check_establish(scanner);  /* Make new connections if possible                */
+   libopm_check_poll(scanner);       /* Poll connections for IO  and proxy test         */
+   libopm_check_closed(scanner);     /* Check for closed or timed out connections       */
+   libopm_check_queue(scanner);      /* Move scans from the queue to the live scan list */
 }
 
 
@@ -599,9 +598,9 @@ void opm_cycle(OPM_T *scanner)
  *    None
  */
 
-void check_queue(OPM_T *scanner)
+static void libopm_check_queue(OPM_T *scanner)
 {
-   node_t *node;
+   OPM_NODE_T *node;
    unsigned int protocols, projected, fd_limit;
 
    if(LIST_SIZE(scanner->queue) == 0)
@@ -618,8 +617,8 @@ void check_queue(OPM_T *scanner)
    {
       /* Scans on the top of the queue were added first, swap the head off the
          top of the queue and add it to the tail of the live scan list */
-      node = list_remove(scanner->queue, scanner->queue->head);
-      list_add(scanner->scans, node);
+      node = libopm_list_remove(scanner->queue, scanner->queue->head);
+      libopm_list_add(scanner->scans, node);
       projected += protocols;
    }
 
@@ -639,14 +638,14 @@ void check_queue(OPM_T *scanner)
  *   None
  */
 
-void check_establish(OPM_T *scanner)
+static void libopm_check_establish(OPM_T *scanner)
 {
-   node_t *node1, *node2;
-   unsigned int fd_limit;
-
+   OPM_NODE_T *node1, *node2;
    OPM_SCAN_T *scan;
    OPM_CONNECTION_T *conn;
 
+   unsigned int fd_limit;
+
    if(LIST_SIZE(scanner->scans) == 0)
       return;
 
@@ -666,7 +665,7 @@ void check_establish(OPM_T *scanner)
 
          conn = (OPM_CONNECTION_T *) node2->data;
          if(conn->state == OPM_STATE_UNESTABLISHED)
-            do_connect(scanner, scan, conn);
+            libopm_do_connect(scanner, scan, conn);
       } 
    }
 }
@@ -690,11 +689,11 @@ void check_establish(OPM_T *scanner)
  *   None
  */
 
-void check_closed(OPM_T *scanner)
+static void libopm_check_closed(OPM_T *scanner)
 {
 
    time_t present;
-   node_t *node1, *node2, *next1, *next2;
+   OPM_NODE_T *node1, *node2, *next1, *next2;
    int timeout;
 
    OPM_SCAN_T *scan;
@@ -721,9 +720,9 @@ void check_closed(OPM_T *scanner)
               close(conn->fd);
               scanner->fd_use--;
 
-              list_remove(scan->connections, node2);
-              connection_free(conn);
-              node_free(node2);
+              libopm_list_remove(scan->connections, node2);
+              libopm_connection_free(conn);
+              libopm_node_free(node2);
               continue;
          }
 
@@ -734,11 +733,11 @@ void check_closed(OPM_T *scanner)
               close(conn->fd);
               scanner->fd_use--;         
 
-              list_remove(scan->connections, node2);
-              connection_free(conn);
-              node_free(node2);
+              libopm_list_remove(scan->connections, node2);
+              libopm_connection_free(conn);
+              libopm_node_free(node2);
              
-              do_callback(scanner, setup_remote(scan->remote, conn), OPM_CALLBACK_TIMEOUT, 0); 
+              libopm_do_callback(scanner, libopm_setup_remote(scan->remote, conn), OPM_CALLBACK_TIMEOUT, 0); 
               continue;
          }
       }
@@ -748,11 +747,11 @@ void check_closed(OPM_T *scanner)
          scan from the scanner, and free it up */
       if(LIST_SIZE(scan->connections) == 0)
       {
-         do_callback(scanner, setup_remote(scan->remote, conn), OPM_CALLBACK_END, 0);
+         libopm_do_callback(scanner, libopm_setup_remote(scan->remote, conn), OPM_CALLBACK_END, 0);
 
-         list_remove(scanner->scans, node1);
-         scan_free(scan);
-         node_free(node1);
+         libopm_list_remove(scanner->scans, node1);
+         libopm_scan_free(scan);
+         libopm_node_free(node1);
       }
    }
 }
@@ -771,7 +770,7 @@ void check_closed(OPM_T *scanner)
  *    None
  */
 
-void do_connect(OPM_T * scanner, OPM_SCAN_T *scan, OPM_CONNECTION_T *conn)
+static void libopm_do_connect(OPM_T * scanner, OPM_SCAN_T *scan, OPM_CONNECTION_T *conn)
 {
    struct sockaddr_in *addr;
   
@@ -808,9 +807,9 @@ void do_connect(OPM_T * scanner, OPM_SCAN_T *scan, OPM_CONNECTION_T *conn)
  *    None
  */
 
-void check_poll(OPM_T *scanner)
+static void libopm_check_poll(OPM_T *scanner)
 {
-   node_t *node1, *node2;
+   OPM_NODE_T *node1, *node2;
    OPM_SCAN_T *scan;
    OPM_CONNECTION_T *conn;
   
@@ -882,17 +881,20 @@ void check_poll(OPM_T *scanner)
             if(ufds[i].fd == conn->fd)
             {
                if(ufds[i].revents & POLLIN)
-                  do_readready(scanner, scan, conn);
+                  libopm_do_readready(scanner, scan, conn);
                if(ufds[i].revents & POLLOUT)
-                  do_writeready(scanner, scan, conn);
+                  libopm_do_writeready(scanner, scan, conn);
                if(ufds[i].revents & POLLHUP)
-                  do_hup(scanner, scan, conn);
+                  libopm_do_hup(scanner, scan, conn);
             }
          }
       }
    }
 }
 
+
+
+
 /* do_readready
  *
  *    Remote connection is read ready, read the data into a buffer and check it against 
@@ -907,7 +909,7 @@ void check_poll(OPM_T *scanner)
  *       None
  */
 
-void do_readready(OPM_T *scanner, OPM_SCAN_T *scan, OPM_CONNECTION_T *conn)
+static void libopm_do_readready(OPM_T *scanner, OPM_SCAN_T *scan, OPM_CONNECTION_T *conn)
 {
    int max_read;
    char c;
@@ -928,7 +930,7 @@ void do_readready(OPM_T *scanner, OPM_SCAN_T *scan, OPM_CONNECTION_T *conn)
 
             if(conn->bytes_read >= max_read)
             {
-               do_callback(scanner, setup_remote(scan->remote, conn), OPM_CALLBACK_ERROR, OPM_ERR_MAX_READ);
+               libopm_do_callback(scanner, libopm_setup_remote(scan->remote, conn), OPM_CALLBACK_ERROR, OPM_ERR_MAX_READ);
                conn->state = OPM_STATE_CLOSED;
                return;
             }
@@ -940,7 +942,7 @@ void do_readready(OPM_T *scanner, OPM_SCAN_T *scan, OPM_CONNECTION_T *conn)
             {
                conn->readbuf[conn->readlen] = '\0';
                conn->readlen = 0;
-               do_read(scanner, scan, conn);
+               libopm_do_read(scanner, scan, conn);
                continue;
             }
              
@@ -952,6 +954,9 @@ void do_readready(OPM_T *scanner, OPM_SCAN_T *scan, OPM_CONNECTION_T *conn)
    }
 }
 
+
+
+
 /* do_read
  *
  *    A line of data has been read from the socket, check it against
@@ -968,14 +973,14 @@ void do_readready(OPM_T *scanner, OPM_SCAN_T *scan, OPM_CONNECTION_T *conn)
  *       None
  */
 
-void do_read(OPM_T *scanner, OPM_SCAN_T *scan, OPM_CONNECTION_T *conn)
+static void libopm_do_read(OPM_T *scanner, OPM_SCAN_T *scan, OPM_CONNECTION_T *conn)
 {
    char *target_string;
  
    target_string = (char *) libopm_config(scanner->config, OPM_CONFIG_TARGET_STRING);
 
    if(strstr(conn->readbuf, target_string))
-      do_openproxy(scanner, scan, conn);
+      libopm_do_openproxy(scanner, scan, conn);
 }
 
 
@@ -993,7 +998,7 @@ void do_read(OPM_T *scanner, OPM_SCAN_T *scan, OPM_CONNECTION_T *conn)
  *       None
  */
 
-void do_openproxy(OPM_T *scanner, OPM_SCAN_T *scan, OPM_CONNECTION_T *conn)
+static void libopm_do_openproxy(OPM_T *scanner, OPM_SCAN_T *scan, OPM_CONNECTION_T *conn)
 {
    OPM_REMOTE_T *remote;
    OPM_PROTOCOL_T *protocol;
@@ -1004,9 +1009,12 @@ void do_openproxy(OPM_T *scanner, OPM_SCAN_T *scan, OPM_CONNECTION_T *conn)
    conn->state = OPM_STATE_CLOSED;
 
    /* Call client's open proxy callback */
-   do_callback(scanner, setup_remote(scan->remote, conn), OPM_CALLBACK_OPENPROXY, 0);
+   libopm_do_callback(scanner, libopm_setup_remote(scan->remote, conn), OPM_CALLBACK_OPENPROXY, 0);
 }
 
+
+
+
 /*  do_writeready
  *
  *    Remote connection is write ready, call the specific protocol
@@ -1021,7 +1029,7 @@ void do_openproxy(OPM_T *scanner, OPM_SCAN_T *scan, OPM_CONNECTION_T *conn)
  *       None
  */
 
-void do_writeready(OPM_T *scanner, OPM_SCAN_T *scan, OPM_CONNECTION_T *conn)
+static void libopm_do_writeready(OPM_T *scanner, OPM_SCAN_T *scan, OPM_CONNECTION_T *conn)
 {
    OPM_PROTOCOL_T *protocol;
 
@@ -1049,7 +1057,7 @@ void do_writeready(OPM_T *scanner, OPM_SCAN_T *scan, OPM_CONNECTION_T *conn)
  *       None
  */
 
-void do_hup(OPM_T *scanner, OPM_SCAN_T *scan, OPM_CONNECTION_T *conn)
+static void libopm_do_hup(OPM_T *scanner, OPM_SCAN_T *scan, OPM_CONNECTION_T *conn)
 {
    OPM_REMOTE_T *remote;
    OPM_PROTOCOL_T *protocol;
@@ -1059,11 +1067,12 @@ void do_hup(OPM_T *scanner, OPM_SCAN_T *scan, OPM_CONNECTION_T *conn)
   /* Mark the connection for close */
    conn->state = OPM_STATE_CLOSED;
 
-   do_callback(scanner, setup_remote(scan->remote, conn), OPM_CALLBACK_NEGFAIL, 0);
+   libopm_do_callback(scanner, libopm_setup_remote(scan->remote, conn), OPM_CALLBACK_NEGFAIL, 0);
 }
 
 
 
+
 /* do_callback
  * 
  *    Call callback
@@ -1077,7 +1086,7 @@ void do_hup(OPM_T *scanner, OPM_SCAN_T *scan, OPM_CONNECTION_T *conn)
  *    None
  */
 
-void do_callback(OPM_T *scanner, OPM_REMOTE_T *remote, int type, int var)
+static void libopm_do_callback(OPM_T *scanner, OPM_REMOTE_T *remote, int type, int var)
 {
    /* Callback is out of range */
    if(type < 0 || type >= (CBLEN + 1))
@@ -1104,7 +1113,7 @@ void do_callback(OPM_T *scanner, OPM_REMOTE_T *remote, int type, int var)
  *    remote
  */
 
-OPM_REMOTE_T *setup_remote(OPM_REMOTE_T *remote, OPM_CONNECTION_T *conn)
+static OPM_REMOTE_T *libopm_setup_remote(OPM_REMOTE_T *remote, OPM_CONNECTION_T *conn)
 {
    remote->port = conn->port;
    remote->bytes_read = conn->bytes_read;
index bb84a306fb8641bd0229b228fa5edb8c506d2619..50a5e23c6eac43e635ad0436f406b29ae14a4ece 100644 (file)
@@ -20,7 +20,7 @@ typedef int OPM_PROXYREAD_T  (OPM_T *, OPM_SCAN_T *, OPM_CONNECTION_T *);
 
 struct _OPM_SCAN { 
    OPM_REMOTE_T        *remote;         /* Pointed to the OPM_REMOTE_T for this scan, passed by client */
-   list_t              *connections;    /* List of individual connections of this scan (1 for each protocol) */
+   OPM_LIST_T          *connections;    /* List of individual connections of this scan (1 for each protocol) */
 };
 
 struct _OPM_CONNECTION {
index 0580594f29e2d9dfbfc1acaecb0b0716edd38b77..92146db1794dfdbf7e4c56bf3c5ae265de882695 100644 (file)
@@ -30,9 +30,9 @@
 
 RCSID("$Id$");
 
-node_t *node_create(void *data)
+OPM_NODE_T *libopm_node_create(void *data)
 {
-   node_t *node = MyMalloc(sizeof(node_t));
+   OPM_NODE_T *node = MyMalloc(sizeof(OPM_NODE_T));
    node->next = NULL;
    node->prev = NULL;  
    node->data = (void *) data;
@@ -40,9 +40,9 @@ node_t *node_create(void *data)
    return node;
 }
 
-list_t *list_create()
+OPM_LIST_T *libopm_list_create()
 {
-   list_t *list = MyMalloc(sizeof(list_t));
+   OPM_LIST_T *list = MyMalloc(sizeof(OPM_LIST_T));
 
    list->head = NULL;
    list->tail = NULL;
@@ -52,7 +52,7 @@ list_t *list_create()
    return list;
 }
 
-node_t *list_add(list_t *list, node_t *node)
+OPM_NODE_T *libopm_list_add(OPM_LIST_T *list, OPM_NODE_T *node)
 {
 
    if(list == NULL || node == NULL)
@@ -78,9 +78,9 @@ node_t *list_add(list_t *list, node_t *node)
    return node;
 }
 
-node_t *list_remove(list_t *list, node_t *node)
+OPM_NODE_T *libopm_list_remove(OPM_LIST_T *list, OPM_NODE_T *node)
 {
-   node_t *p;
+   OPM_NODE_T *p;
 
    if(list == NULL || node == NULL)
       return NULL;
@@ -123,12 +123,12 @@ node_t *list_remove(list_t *list, node_t *node)
    return NULL;
 }
 
-void list_free(list_t *list)
+void libopm_list_free(OPM_LIST_T *list)
 {
    MyFree(list);
 }
 
-void node_free(node_t *node)
+void libopm_node_free(OPM_NODE_T *node)
 {
    MyFree(node);
 }
index fc7038e112f910e99d613ea94d357e5b9dddd2f7..c49d012e701c74eb13b4b11356e6a70ae23e40c6 100644 (file)
 #define LIST_SIZE(list) list->elements
 /* End Copyright */
 
-node_t *node_create(void *);
-list_t *list_create(void);
+OPM_NODE_T *libopm_node_create(void *);
+OPM_LIST_T *libopm_list_create(void);
 
-node_t *list_add(list_t *, node_t *);
-node_t *list_remove(list_t *, node_t *);
+OPM_NODE_T *libopm_list_add(OPM_LIST_T *, OPM_NODE_T *);
+OPM_NODE_T *libopm_list_remove(OPM_LIST_T *, OPM_NODE_T *);
 
-void list_free(list_t *);
-void node_free(node_t *);
+void libopm_list_free(OPM_LIST_T *);
+void libopm_node_free(OPM_NODE_T *);
 
 #endif /* LIST_H */
index 0b55de6bc61ff814a3a3390f7c681fbcaf86bff9..80b33f3b045ac61841ed966a71db782ec9966fab 100644 (file)
--- a/src/opm.h
+++ b/src/opm.h
@@ -24,9 +24,9 @@ struct _OPM_CONFIG {
 
 struct _OPM {
    OPM_CONFIG_T *config;               /* Individual scanner configuration                           */
-   list_t       *queue;                /* List of scans in the queue (not yet established)           */
-   list_t       *scans;                /* List of scans (each scan containing a list of connections) */
-   list_t       *protocols;            /* List of protocols this scanner handles                     */
+   OPM_LIST_T   *queue;                /* List of scans in the queue (not yet established)           */
+   OPM_LIST_T   *scans;                /* List of scans (each scan containing a list of connections) */
+   OPM_LIST_T   *protocols;            /* List of protocols this scanner handles                     */
    unsigned int  fd_use;               /* Number of file descriptors in use                          */
 
    OPM_CALLBACK_T **callbacks;          /* Scanner wide callbacks                                     */
index 26eb11dc53ede05de1dc94c8852983d9ac0ef574..18aeda8e1acb2fced9ee28a4ca9c77615c081112 100644 (file)
@@ -1,24 +1,24 @@
 #ifndef OPM_COMMON_H
 #define OPM_COMMON_H
 
-typedef struct _node node_t;
-typedef struct _list list_t;
+typedef struct _libopm_node OPM_NODE_T;
+typedef struct _libopm_list OPM_LIST_T;
 
 
-struct _list {
+struct _libopm_list {
 
-  struct _node *head;
-  struct _node *tail;
-  int elements;
+  struct _libopm_node *head;
+  struct _libopm_node *tail;
 
+  int elements;
 };
 
-struct _node {
+struct _libopm_node {
 
-   struct _node *next; 
-   struct _node *prev;
-   void *data;
+   struct _libopm_node *next; 
+   struct _libopm_node *prev;
 
+   void *data;
 };
 
 #endif /* OPM_COMMON_H */