From: michael Date: Tue, 5 May 2015 18:27:29 +0000 (+0000) Subject: - Whitespace changes X-Git-Tag: 1.0.6~26 X-Git-Url: http://git.serene-ircd.net/?a=commitdiff_plain;h=2aaf6010c61b2da74bb84f6365adc41e1227ef7d;p=hopm.git - Whitespace changes git-svn-id: svn://svn.ircd-hybrid.org/svnroot/hopm/branches/1.0.x@5910 82007160-df01-0410-b94d-b575c5fd34c7 --- diff --git a/src/libopm/src/config.h b/src/libopm/src/config.h index 92ad616..f351ce1 100644 --- a/src/libopm/src/config.h +++ b/src/libopm/src/config.h @@ -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 */ diff --git a/src/libopm/src/libopm.c b/src/libopm/src/libopm.c index 5c8bd18..9e9c23b 100644 --- a/src/libopm/src/libopm.c +++ b/src/libopm/src/libopm.c @@ -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: diff --git a/src/libopm/src/libopm.h b/src/libopm/src/libopm.h index 2c0997d..cffd545 100644 --- a/src/libopm/src/libopm.h +++ b/src/libopm/src/libopm.h @@ -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 */ diff --git a/src/libopm/src/opm.h b/src/libopm/src/opm.h index e8beb85..aca1765 100644 --- a/src/libopm/src/opm.h +++ b/src/libopm/src/opm.h @@ -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 */ diff --git a/src/libopm/src/opm_common.h b/src/libopm/src/opm_common.h index 18aeda8..3a9bf6d 100644 --- a/src/libopm/src/opm_common.h +++ b/src/libopm/src/opm_common.h @@ -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 */ diff --git a/src/libopm/src/opm_error.h b/src/libopm/src/opm_error.h index 9c11388..ec55793 100644 --- a/src/libopm/src/opm_error.h +++ b/src/libopm/src/opm_error.h @@ -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 */ diff --git a/src/libopm/src/opm_types.h b/src/libopm/src/opm_types.h index 3c17384..b83a40a 100644 --- a/src/libopm/src/opm_types.h +++ b/src/libopm/src/opm_types.h @@ -32,9 +32,10 @@ #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 */ diff --git a/src/libopm/src/proxy.c b/src/libopm/src/proxy.c index 2198710..92a770f 100644 --- a/src/libopm/src/proxy.c +++ b/src/libopm/src/proxy.c @@ -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); diff --git a/src/libopm/src/proxy.h b/src/libopm/src/proxy.h index ef21d5e..dae8bc3 100644 --- a/src/libopm/src/proxy.h +++ b/src/libopm/src/proxy.h @@ -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 */