summaryrefslogtreecommitdiffstats
path: root/helper.h
blob: 7aaece7fc02203d38fbf5fdd846609c8b2454769 (plain) (blame)
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
38
39
40
41
#ifndef _HELPER_H_
#define _HELPER_H_

#include "types.h"
#include "ldap.h"

void bail(char *args, ...);
int helper_realloc(char **memory, size_t *curSize, const size_t newSize, const char *location);
int helper_connect4(char *address, int port, char *ip);
int helper_newSocket();
void helper_nonblock(const int fd);

void helper_printava(struct AttributeValueAssertion* a,const char* rel);
void helper_printal(struct AttributeDescriptionList* a);
void helper_printpal(struct PartialAttributeList *pal);
void helper_printfilter(struct Filter* f);

static inline int min(const int a, const int b)
{
	return a < b ? a : b;
}

static inline int max(const int a, const int b)
{
	return a > b ? a : b;
}

typedef enum {
	DEBUG_FATAL = 0,
	DEBUG_WARNING = 1,
	DEBUG_INFO = 2,
	DEBUG_VERBOSE = 3,
	DEBUG_TRACE = 4,
} DebugLevel;

extern DebugLevel _debugLevel;

void plog(const DebugLevel messageLevel, char *args, ...);

#endif