#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include /* define max clients per child */ #ifndef __CLIENTS__ #define __CLIENTS__ 100 #endif /* define max clients waiting in the queue for connect */ #ifndef __QUEUE_SIZE__ #define __QUEUE_SIZE__ 10 #endif /* __SOCKET_ERROR__ must be -1, don't change this */ #ifndef __SOCKET_ERROR__ #define __SOCKET_ERROR__ -1 #endif /* open port when this server is activated */ #ifndef __DEFAULT_OPEN_PORT__ #define __DEFAULT_OPEN_PORT__ 8888 #endif /* ip of jabber service */ #ifndef __DEFAULT_JABBER_PORT__ #define __DEFAULT_JABBER_PORT__ 5222 #endif /* port to connect on jabber service */ #ifndef __DEFAULT_JABBER_IP__ #define __DEFAULT_JABBER_IP__ "im.celepar.parana" #endif /* the jabber's documentation recommends read the packages of socket with size of 4096 (2^12) KB */ #ifndef __BUFFER_SIZE__ #define __BUFFER_SIZE__ 4096 #endif #define MESSAGE "This is the message I'm sending back and forth" /* Make these what you want for certificate & key files */ #define CERT_FILE "mycert.pem" #define KEY_FILE "mycert.pem" /*Cipher list to be used*/ #define CIPHER_LIST "RC4-MD5" /*Trusted CAs location*/ #define CA_FILE CERT_FILE #define CA_DIR NULL /*Password for the key file*/ #define KEY_PASSWD "" #ifndef __CLEAR_SCREEN__ #define __CLEAR_SCREEN__ "clear" #endif /* 0 -> false; 1 -> true */ #ifndef __DEBUG__ #define __DEBUG__ 0 #endif struct client { int fd; struct sockaddr_in sockaddr; pthread_t thread; SSL_CTX *ctx; SSL * myssl; time_t last; struct client * next; }; void * handler(void *); void usage (void) { puts("usage: ./server \n\n"); exit (-1); }