- Whitespace changes
authormichael <michael@82007160-df01-0410-b94d-b575c5fd34c7>
Tue, 5 May 2015 18:27:29 +0000 (18:27 +0000)
committermichael <michael@82007160-df01-0410-b94d-b575c5fd34c7>
Tue, 5 May 2015 18:27:29 +0000 (18:27 +0000)
git-svn-id: svn://svn.ircd-hybrid.org/svnroot/hopm/branches/1.0.x@5910 82007160-df01-0410-b94d-b575c5fd34c7

src/libopm/src/config.h
src/libopm/src/libopm.c
src/libopm/src/libopm.h
src/libopm/src/opm.h
src/libopm/src/opm_common.h
src/libopm/src/opm_error.h
src/libopm/src/opm_types.h
src/libopm/src/proxy.c
src/libopm/src/proxy.h

index 92ad616954cf59ea8a18ea724f6db566d1d2e490..f351ce17e36b615336be15e8de951467cb9a8d4f 100644 (file)
@@ -1,13 +1,14 @@
 #ifndef CONFIG_H
 #define CONFIG_H
 
-#include "libopm.h" 
+#include "libopm.h"
 
 typedef struct _opm_config_hash OPM_CONFIG_HASH_T;
 
-struct _opm_config_hash {
-   int key;
-   int type;
+struct _opm_config_hash
+{
+  int key;
+  int type;
 };
 
 void libopm_config_free(OPM_CONFIG_T *);
@@ -15,6 +16,4 @@ void *libopm_config(OPM_CONFIG_T *, int);
 int libopm_config_gettype(int);
 OPM_CONFIG_T *libopm_config_create(void);
 OPM_ERR_T libopm_config_set(OPM_CONFIG_T *, int , const void *);
-
-
 #endif /* CONFIG_H */
index 5c8bd1809d3d90cb3c28f971c2a00ee35fe46007..9e9c23b62bcfe7ee0ba4a9adddae3c047c141908 100644 (file)
@@ -18,7 +18,7 @@
  *       59 Temple Place - Suite 330
  *       Boston, MA  02111-1307, USA.
  *
- *                  
+ *
  */
 
 #include "setup.h"
@@ -594,9 +594,9 @@ opm_active(OPM_T *scanner)
  *    scanner: Scanner the scan is being created for. This
  *             is needed to get information on currently set
  *             protocols/config.
- *             
+ *
  *    remote: Remote host this scan will be scanning
- *    
+ *
  * Return
  *    Address of new struct
  */
@@ -646,7 +646,7 @@ libopm_scan_create(OPM_T *scanner, OPM_REMOTE_T *remote)
  *
  * Parametsr:
  *    scan: Scan struct to free
- * 
+ *
  * Return:
  *    None
  */
@@ -737,7 +737,7 @@ opm_cycle(OPM_T *scanner)
  * Move scans from the queue to the live scan list as long as there is
  * room.
  *
- * Parameters: 
+ * Parameters:
  *    scanner: Scanner to check queue on
  *
  * Return:
@@ -825,7 +825,7 @@ libopm_check_establish(OPM_T *scanner)
 }
 
 /* check_closed
- * 
+ *
  * Check for connections which have timed out or are
  * closed. Connections timed out still need to be closed.
  *
@@ -909,7 +909,7 @@ libopm_check_closed(OPM_T *scanner)
  * Parametsr:
  *    scan: Scan struct containing the connection
  *    conn: Connection to establish
- * Return: 
+ * Return:
  *    None
  */
 static void
@@ -1067,8 +1067,8 @@ libopm_check_poll(OPM_T *scanner)
 
 /* do_readready
  *
- *    Remote connection is read ready, read the data into a buffer and check it against 
- *    the target_string if neccessary 
+ *    Remote connection is read ready, read the data into a buffer and check it against
+ *    the target_string if neccessary
  *
  *    Parameters:
  *       scanner: Scanner doing the scan
@@ -1180,7 +1180,7 @@ libopm_do_read(OPM_T *scanner, OPM_SCAN_T *scan, OPM_CONNECTION_T *conn)
 
 /* do_openproxy
  *
- *    An open proxy was found on connection conn. Cleanup the connection and 
+ *    An open proxy was found on connection conn. Cleanup the connection and
  *    call the appropriate callback to let the client know the proxy was found.
  *
  *    Parameters:
@@ -1259,7 +1259,7 @@ libopm_do_hup(OPM_T *scanner, OPM_SCAN_T *scan, OPM_CONNECTION_T *conn)
 }
 
 /* do_callback
- * 
+ *
  *    Call callback
  *
  * Parameters:
index 2c0997d8147a7f250f42696f351c56867930ec24..cffd5459587e1603518750ef12b9933feda3a076 100644 (file)
@@ -6,53 +6,51 @@
 #include "opm_common.h"
 #include "opm.h"
 
-#define CBLEN 5            /* Number of callback functions  */
-#define READBUFLEN 128    /* Size of conn->readbuf         */
-#define SENDBUFLEN 512     /* Size of sendbuffer in proxy.c */
+#define CBLEN 5         /* Number of callback functions  */
+#define READBUFLEN 128  /* Size of conn->readbuf         */
+#define SENDBUFLEN 512  /* Size of sendbuffer in proxy.c */
 
 typedef struct  _OPM_SCAN             OPM_SCAN_T;
 typedef struct  _OPM_CONNECTION       OPM_CONNECTION_T;
 typedef struct  _OPM_PROTOCOL_CONFIG  OPM_PROTOCOL_CONFIG_T;
 typedef struct  _OPM_PROTOCOL         OPM_PROTOCOL_T;
 
-/*  Types of hard coded proxy READ/WRITE functions which are 
-   setup in a table in libopm.c */
-
+/*
+ * Types of hard coded proxy READ/WRITE functions which are
+ * setup in a table in libopm.c
+ */
 typedef int OPM_PROXYWRITE_T (OPM_T *, OPM_SCAN_T *, OPM_CONNECTION_T *);
 typedef int OPM_PROXYREAD_T  (OPM_T *, OPM_SCAN_T *, OPM_CONNECTION_T *);
 
-struct _OPM_SCAN { 
-   opm_sockaddr         addr;           /* Address in byte order of remote client */
-   OPM_REMOTE_T        *remote;         /* Pointed to the OPM_REMOTE_T for this scan, passed by client */
-   OPM_LIST_T          *connections;    /* List of individual connections of this scan (1 for each protocol) */
+struct _OPM_SCAN
+{
+  opm_sockaddr         addr;           /* Address in byte order of remote client */
+  OPM_REMOTE_T        *remote;         /* Pointed to the OPM_REMOTE_T for this scan, passed by client */
+  OPM_LIST_T          *connections;    /* List of individual connections of this scan (1 for each protocol) */
 };
 
-struct _OPM_CONNECTION {
-
-   OPM_PROTOCOL_T     *protocol;        /* Pointer to specific protocol this connection handles */
-   unsigned short int  port;            /* Some protocols have multiple ports, eg. HTTP */
-
-   int                fd;               /* Allocated file descriptor, 0 if not yet allocated */
-   unsigned short int bytes_read;       /* Bytes read so far in this connection */
-   char               readbuf[READBUFLEN + 1]; /* 128 byte read buffer, anything over 128 is probably not of use */
-   unsigned short int readlen;          /* Length of readbuf */
-   unsigned short int state;            /* State of connection */
-   time_t             creation;         /* When this connection was established */
+struct _OPM_CONNECTION
+{
+  OPM_PROTOCOL_T     *protocol;        /* Pointer to specific protocol this connection handles */
+  unsigned short int  port;            /* Some protocols have multiple ports, eg. HTTP */
+  int                fd;               /* Allocated file descriptor, 0 if not yet allocated */
+  unsigned short int bytes_read;       /* Bytes read so far in this connection */
+  char               readbuf[READBUFLEN + 1]; /* 128 byte read buffer, anything over 128 is probably not of use */
+  unsigned short int readlen;          /* Length of readbuf */
+  unsigned short int state;            /* State of connection */
+  time_t             creation;         /* When this connection was established */
 };
 
 struct _OPM_PROTOCOL_CONFIG
 {
-   OPM_PROTOCOL_T *type;                /* Protocol type */
-   unsigned short int port;             /* Port to connect on */
-
+  OPM_PROTOCOL_T *type;                /* Protocol type */
+  unsigned short int port;             /* Port to connect on */
 };
 
 struct _OPM_PROTOCOL
 {
-   int type;                            /* Protocol type */
-
-   OPM_PROXYWRITE_T *write_function;    /* Write function handler for this protocol */
-   OPM_PROXYREAD_T  *read_function;     /* Read function handler for this protocol */
+  int type;                            /* Protocol type */
+  OPM_PROXYWRITE_T *write_function;    /* Write function handler for this protocol */
+  OPM_PROXYREAD_T  *read_function;     /* Read function handler for this protocol */
 };
-
 #endif /* LIBOPM_H */
index e8beb85b44eb76ff6a5384b618f6be6b2711d6fc..aca176534cf7da961b8f16e13719ef573eacbc8a 100644 (file)
@@ -18,36 +18,35 @@ typedef         int                   OPM_ERR_T;
 
 typedef void OPM_CALLBACK_FUNC (OPM_T *, OPM_REMOTE_T *, int, void *);
 
-struct _OPM_CALLBACK {
-   OPM_CALLBACK_FUNC *func;
-   void *data;
+struct _OPM_CALLBACK
+{
+  OPM_CALLBACK_FUNC *func;
+  void *data;
 };
 
-struct _OPM_CONFIG {
-   void **vars;
+struct _OPM_CONFIG
+{
+  void **vars;
 };
 
-struct _OPM {
-   OPM_CONFIG_T *config;               /* Individual scanner configuration                           */
-   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                                     */
+struct _OPM
+{
+  OPM_CONFIG_T *config;               /* Individual scanner configuration                           */
+  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                                     */
 };
 
-struct _OPM_REMOTE {
-
-   char                *ip;              /* Readable IP address                         */
-
-   unsigned short int   port;            /* Port passed back on certain callbacks       */
-   unsigned short int   protocol;        /* Protocol passed back on certain callbacks   */
-   unsigned short int   bytes_read;      /* Bytes read passed back on certain callbacks */
-
-   OPM_LIST_T           *protocols;      /* Remote specific protocols */
-
-   void                 *data;           /* Arbitrary data that the client can point to for any purpose*/
+struct _OPM_REMOTE
+{
+  char                *ip;              /* Readable IP address                         */
+  unsigned short int   port;            /* Port passed back on certain callbacks       */
+  unsigned short int   protocol;        /* Protocol passed back on certain callbacks   */
+  unsigned short int   bytes_read;      /* Bytes read passed back on certain callbacks */
+  OPM_LIST_T           *protocols;      /* Remote specific protocols */
+  void                 *data;           /* Arbitrary data that the client can point to for any purpose*/
 };
 
 OPM_T *opm_create(void);
@@ -68,5 +67,4 @@ OPM_ERR_T opm_callback(OPM_T *, int, OPM_CALLBACK_FUNC *, void *);
 void opm_cycle(OPM_T *);
 
 size_t opm_active(OPM_T *);
-
 #endif /* OPM_H */
index 18aeda8e1acb2fced9ee28a4ca9c77615c081112..3a9bf6dc1012b83446ab9e9b7e5b7320ddbd5ddc 100644 (file)
@@ -5,20 +5,17 @@ typedef struct _libopm_node OPM_NODE_T;
 typedef struct _libopm_list OPM_LIST_T;
 
 
-struct _libopm_list {
-
+struct _libopm_list
+{
   struct _libopm_node *head;
   struct _libopm_node *tail;
-
   int elements;
 };
 
-struct _libopm_node {
-
-   struct _libopm_node *next; 
-   struct _libopm_node *prev;
-
-   void *data;
+struct _libopm_node
+{
+  struct _libopm_node *next;
+  struct _libopm_node *prev;
+  void *data;
 };
-
 #endif /* OPM_COMMON_H */
index 9c113884991c2c8575c71bf5544d09b4eb02d7ba..ec55793384796546ec367e95a42d0d404ee4a03d 100644 (file)
@@ -5,22 +5,22 @@
 #define OPM_SUCCESS               1
 
 /* Configuration Errors */
-#define OPM_ERR_BADKEY            2 /* Unknown or bad key value */
-#define OPM_ERR_BADVALUE          3 /* Bad value matching key */
-#define OPM_ERR_BADPROTOCOL       4 /* Unknown protocol in config */
+#define OPM_ERR_BADKEY            2  /* Unknown or bad key value */
+#define OPM_ERR_BADVALUE          3  /* Bad value matching key */
+#define OPM_ERR_BADPROTOCOL       4  /* Unknown protocol in config */
 
 /* Read Errors */
-#define OPM_ERR_MAX_READ          5 /* Socket reached MAX_READ */
+#define OPM_ERR_MAX_READ          5  /* Socket reached MAX_READ */
 
 /* Callback Registration Errors */
-#define OPM_ERR_CBNOTFOUND        6 /* Callback is out of range */
+#define OPM_ERR_CBNOTFOUND        6  /* Callback is out of range */
 
 /* opm_scan errors */
-#define OPM_ERR_BADADDR           7 /* IP in remote struct is bad */
-#define OPM_ERR_NOPROTOCOLS       8 /* No protocols to scan! */
+#define OPM_ERR_BADADDR           7  /* IP in remote struct is bad */
+#define OPM_ERR_NOPROTOCOLS       8  /* No protocols to scan! */
 
 /* bind/connect errors */
-#define OPM_ERR_BIND              9 /* Error binding to BIND_IP */
-#define OPM_ERR_NOFD              10/* Unable to allocate file descriptor */
+#define OPM_ERR_BIND              9  /* Error binding to BIND_IP */
+#define OPM_ERR_NOFD              10  /* Unable to allocate file descriptor */
 
 #endif /* LIBOPM_ERROR_H */
index 3c1738467a20d6263092bf3962c92ea5eff0f9fb..b83a40a371bc7cdfd315d8d76cc971336c36957e 100644 (file)
 #define OPM_STATE_CLOSED         4
 
 
-/* Callbacks -- If more callback types are added,
-   CBLEN will need to be changed in libopm.h accordingly */
-
+/*
+ * Callbacks -- If more callback types are added, CBLEN will
+ * need to be changed in libopm.h accordingly
+ */
 #define OPM_CALLBACK_OPENPROXY   0 /* An open proxy has been found REMOTE/SCANNER      */
 #define OPM_CALLBACK_NEGFAIL     1 /* Negotiation to a proxy has failed REMOTE/SCANNER */
 #define OPM_CALLBACK_END         2 /* A scan has ended REMOTE/SCANNER                  */
index 21987101c5cb408e6f6582094e90ff29a14170a1..92a770f945d0526c10bc5ad7f72fa05836d08853 100644 (file)
@@ -143,7 +143,7 @@ libopm_proxy_socks5_write(OPM_T *scanner, OPM_SCAN_T *scan, OPM_CONNECTION_T *co
   scan_port = *(int *)libopm_config(scanner->config, OPM_CONFIG_SCAN_PORT);
 
   if (inet_pton(AF_INET, scan_ip, &addr) <= 0)
-    ; /* handle error */
+    ;  /* handle error */
 
   laddr = htonl(addr.s_addr);
 
index ef21d5e192f3c2ec09b96ec42cadd9e9db3b05e6..dae8bc3b001c6020b86d698b1ae89fc97cde96d3 100644 (file)
@@ -9,6 +9,4 @@ int libopm_proxy_socks5_write(OPM_T *, OPM_SCAN_T *, OPM_CONNECTION_T *);
 int libopm_proxy_wingate_write(OPM_T *, OPM_SCAN_T *, OPM_CONNECTION_T *);
 int libopm_proxy_router_write(OPM_T *, OPM_SCAN_T *, OPM_CONNECTION_T *);
 int libopm_proxy_httppost_write(OPM_T *, OPM_SCAN_T *, OPM_CONNECTION_T *);
-
-
 #endif /* PROXY_H */