summaryrefslogtreecommitdiff
path: root/sockets.h
blob: c342de2126cee535bf86d343001e732bace8ca35 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#ifndef SOCKETS_H_INCLUDED
#define SOCKETS_H_INCLUDED

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <netdb.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <sys/select.h>
#include <openssl/ssl.h>
#include <openssl/err.h>

#define BACKLOG 10 // maximum length to which the queue of pending connections for sockfd may grow

// get sockaddr, IPv4 or IPv6:
void *get_in_addr(struct sockaddr *sa);

// Create socket to connect to real IRC server
int createserversocket(char *host, char *port);

// Create listening socket to listen for bouncer client connections
int createclientsocket(char *listenport);

void init_openssl();

void cleanup_openssl();

SSL_CTX *create_context();

void configure_context(SSL_CTX *ctx, char *certfile, char *keyfile);

#endif