aboutsummaryrefslogblamecommitdiffstats
path: root/glougloud/glougloud.h
blob: c4f0a4ae0f20e401c77835d02a3a253fd51b1ff5 (plain) (tree)
1
2
3
4
5
6
7
8
9






                       

                        





                           


                                   




























































                                                                         
#include <sys/socket.h>

#include <netinet/in.h>

#include <stdio.h>
#include <pcap.h>

#include <libglouglou.h>

#include "external/queue.h"

#if !defined(__OpenBSD__)
#define setproctitle(x) {}
#endif

#define GLOUGLOUD_USER "_glougloud"
#define PCAP_COUNT 20
#define PCAP_TO 300

/* ipc */

enum imsg_type {
	IMSG_SRVCONN_REQ,
	IMSG_SRVCONN_RES,
	IMSG_USRCONN_REQ,
	IMSG_USRCONN_RES,
	IMSG_USRDNS_REQ,
	IMSG_USRDNS_RES
};

/* XXX restore the _req _res structs, so that we have less bytes going on
 * the pipe */
struct imsg_srvconn {
	struct sockaddr_in addr;
	u_short ok;
	u_short deco;
};
struct imsg_usrconn {
	struct sockaddr_in addr;
	u_short ok;
	u_short deco;
};
struct imsg_usrdns_req {
	struct in_addr addr;
};
struct imsg_usrdns_res {
	struct in_addr addr;
	char name[DNSNAME_MAX];
};

/* glougloud.c */

extern int net_socket;

/* server.c */

int	server_init(int *);

/* user.c */

int	user_init(int *, pcap_t *pcap);

/* util.c */

void	log_init(int, int);
void	log_pinvalid(const char *, ...);
void	log_tmp(const char *, ...);
void	log_debug(const char *, ...);
void	log_info(const char *, ...);
void	log_warn(const char *, ...);
void	fatal(const char *, ...);

void	*xmalloc(size_t);
void	*xcalloc(size_t, size_t);
void	fd_nonblock(int);
void	droppriv();
void	addrcpy(struct sockaddr_in *, struct sockaddr_in *);
void	socketpair_prepare(int *);