00001
00008 #ifndef FUNCTIONS_H_
00009 #define FUNCTIONS_H_
00010
00011 #define _GNU_SOURCE
00012
00013 #include "cmdline.h"
00014 #include "structures.h"
00015
00016 #include <netinet/in.h>
00017 #include <string.h>
00018 #include <stdio.h>
00019 #include <stdlib.h>
00020 #include <string.h>
00021 #include <unistd.h>
00022 #include <sys/socket.h>
00023 #include <sys/types.h>
00024 #include <netinet/in.h>
00025 #include <arpa/inet.h>
00026 #include <time.h>
00027 #include <errno.h>
00028
00029 #include "debug.h"
00030 #include "defines.h"
00031 #include "securitas.h"
00032
00033 #define INVALID_CHARS "^\\|\"?;,:"
00034 #define VALID_CHAR '0'
00035
00036 typedef int (*PROCESSOR) (int, void*, char *);
00037
00038
00039
00040
00041 int validate_path(char *path);
00042
00043
00044
00045
00046 void print_error_exit(char *user_mesg, char *error_mesg, int exit_code);
00047
00048
00049
00050
00051 int parse_args(int argc, char *argv[], char **c_filr, char **m_file, int *porto, int *tempo);
00052
00053
00054
00055
00056 int open_socket(uint16_t porto, PROCESSOR processa_pedido, void *args_processor, int *stoping_condition);
00057
00058
00059
00060
00061 int validate_ip(char *ip);
00062
00063
00064
00065
00066 int readline (int fd, char *linha, int max);
00067
00068
00069
00070
00071 int write_to_socket(int fd, char *mesg, char *error_mesg);
00072
00073
00074
00075
00076 void trim_crlf(char *line);
00077
00078 #endif