num = sizeof(HASH) / sizeof(struct CONFIG_HASH);
if(key < 0 || key >= num)
- return 1; /* Return appropriate error code eventually */
+ return OPM_ERR_INVALIDKEY; /* Return appropriate error code eventually */
switch(config_gettype(key))
{
(opm_sockaddr *) config->vars[key] = MyMalloc(sizeof(opm_sockaddr));
if( inetpton(AF_INET, (char *) value, &( ((opm_sockaddr *)config->vars[key])->sa4.sin_addr))
<= 0)
- return 1; /* return appropriate err code */
+ return OPM_ERR_BADADDRESS; /* return appropriate err code */
break;
default:
- return 1; /* return appropriate err code */
+ return OPM_ERR_INVALIDKEY; /* return appropriate err code */
}
* value: Address of value to set variable (key) to
*
* Return:
- * 1: Config variable set
- * 0: Some error occured
+ * OPM_ERR_T containing error code
*/
OPM_ERR_T opm_config(OPM_T *scanner, int key, void *value)
* (write in future error codes)
*/
-int opm_addtype(OPM_T *scanner, int type, int port)
+OPM_ERR_T opm_addtype(OPM_T *scanner, int type, int port)
{
int i;
node_t *node;
conn->state = OPM_STATE_NEGSENT;
}
+
+/* do_error
+ *
+ * Handle error by calling callback fun_error
+ *
+ * Parameters:
+ * scanner: Scanner doing the scan
+ * scan: Specific scan
+ * conn: Specific connection in the scan
+ * error: OPM_ERR_T containing the error type
+ */
+
+void do_error(OPM_REMOTE_T *remote, int error)
+{
+ remote->fun_error(remote, error);
+}
OPM_PROXYREAD_T *read_function; /* Read function handler for this protocol */
};
+void do_error(OPM_REMOTE_T *, int);
+
#endif /* LIBOPM_H */
OPM_ERR_T opm_config(OPM_T *, int, void *);
OPM_ERR_T opm_scan(OPM_T *, OPM_REMOTE_T *);
+OPM_ERR_T opm_addtype(OPM_T *, int, int);
+
OPM_CONFIG_T *config_create();
OPM_ERR_T config_set(OPM_CONFIG_T *, int , void *);
#ifndef LIBOPM_ERROR_H
#define LIBOPM_ERROR_H
-#define OPM_SUCCESS 1
+/* Success */
+#define OPM_SUCCESS 1
+
+/* Configuration Errors */
+#define OPM_ERR_INVALIDKEY 2
+#define OPM_ERR_BADADDRESS 3
+
#endif /* LIBOPM_ERROR_H */
return 0;
}
-void open_proxy(OPM_REMOTE_T *remote, int var)
+void open_proxy(OPM_REMOTE_T *remote, int notused)
{
printf("Open proxy on %s:%d [%d bytes read]\n", remote->ip, remote->port, remote->bytes_read);
}