ze-filter  (ze-filter-0.8.0-develop-180218)
ze-client.h
Go to the documentation of this file.
1 /*
2  *
3  * ze-filter - Mail Server Filter for sendmail
4  *
5  * Copyright (c) 2001-2018 - Jose-Marcio Martins da Cruz
6  *
7  * Auteur : Jose Marcio Martins da Cruz
8  * jose.marcio.mc@gmail.org
9  *
10  * Historique :
11  * Creation : Thu Aug 7 17:05:57 CEST 2008
12  *
13  * This program is free software, but with restricted license :
14  *
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
19  *
20  * More details about ze-filter license can be found at ze-filter
21  * web site : http://foss.jose-marcio.org
22  */
23 
24 
25 #ifndef __ZE_CLIENT_H
26 
32 #define CLIENT_SPEC_LEN 512
33 
34 typedef struct
35 {
36  pthread_mutex_t mutex;
37  bool ok;
38  int signature;
39 
40  /* errors */
41  int nerr;
42  time_t lasterr;
43 
44  int sd;
45  int family;
46  int protocol;
47  int socktype;
49 
50  char spec[CLIENT_SPEC_LEN];
51 } client_T;
52 
53 #define CLIENT_INITIALIZER {PTHREAD_MUTEX_INITIALIZER, \
54  FALSE, SIGNATURE, 0, (time_t ) 0, -1, 0, 0, 0, 0}
55 
56 int client_connect(client_T * client, char *spec, int to);
57 
58 bool client_disconnect(client_T * client, bool incerr);
59 
60 bool client_send(client_T * client, char *buf, size_t size);
61 
62 bool client_recv(client_T * client, char *buf, size_t size);
63 
64 bool client_readln(client_T * client, char *buf, size_t size);
65 
66 int connect_timed(int, struct sockaddr *, socklen_t, int);
67 
70 # define __ZE_CLIENT_H 1
71 #endif /* __ZE_CLIENT_H */
int socklen_t
Definition: ze-sys.h:534
pthread_mutex_t mutex
Definition: ze-client.h:36
int signature
Definition: ze-client.h:38
bool ok
Definition: ze-client.h:37
bool client_send(client_T *client, char *buf, size_t size)
Definition: ze-client.c:263
int family
Definition: ze-client.h:45
int protocol
Definition: ze-client.h:46
int sd
Definition: ze-client.h:44
time_t lasterr
Definition: ze-client.h:42
int connect_timed(int, struct sockaddr *, socklen_t, int)
Definition: ze-client.c:639
int socktype
Definition: ze-client.h:47
socklen_t socklen
Definition: ze-client.h:48
#define CLIENT_SPEC_LEN
Definition: ze-client.h:32
bool client_disconnect(client_T *client, bool incerr)
Definition: ze-client.c:231
int client_connect(client_T *client, char *spec, int to)
Definition: ze-client.c:126
bool client_recv(client_T *client, char *buf, size_t size)
Definition: ze-client.c:355
int nerr
Definition: ze-client.h:41
bool client_readln(client_T *client, char *buf, size_t size)
Definition: ze-client.c:447