1 |
ben |
1 |
/* this is libspopc.c file, part of the libspopc library sources |
2 |
|
|
* copyright © 2002- Benoit Rouits <brouits@free.fr> |
3 |
|
|
* released under the terms of the GNU Lesser General Public Licence. |
4 |
|
|
* |
5 |
|
|
* libspopc offers simple API for a pop3 client. |
6 |
|
|
* See RFC 1725 for pop3 specifications. |
7 |
|
|
* |
8 |
|
|
* This library is free software; you can redistribute it and/or |
9 |
|
|
* modify it under the terms of the GNU Lesser General Public |
10 |
|
|
* License as published by the Free Software Foundation; either |
11 |
|
|
* version 2.1 of the License, or (at your option) any later version. |
12 |
|
|
* |
13 |
|
|
* This library is distributed in the hope that it will be useful, |
14 |
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 |
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
16 |
|
|
* Lesser General Public License for more details. |
17 |
|
|
* |
18 |
|
|
* You should have received a copy of the GNU Lesser General Public |
19 |
|
|
* License along with this library; if not, write to the Free Software |
20 |
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
21 |
|
|
*/ |
22 |
|
|
|
23 |
|
|
#include "libspopc.h" |
24 |
|
|
#include "mutex.h" |
25 |
|
|
|
26 |
|
|
static int LIBSPOPC_UP = 0; |
27 |
|
|
|
28 |
|
|
/* all mutexes are defined here */ |
29 |
|
|
mutex GETHOSTBYNAME; |
30 |
|
|
|
31 |
|
|
/* ALL THESE FUNCTIONS MUST BE CALLED ONCE AT A TIME */ |
32 |
|
|
|
33 |
|
|
/* initialize libspopc, mainly for thread safety */ |
34 |
ben |
6 |
DLLIMPORT int libspopc_init(void) |
35 |
ben |
1 |
{ |
36 |
|
|
if (!LIBSPOPC_UP) |
37 |
|
|
{ |
38 |
|
|
/* initialize all mutexes */ |
39 |
|
|
mutex_init(&GETHOSTBYNAME); |
40 |
|
|
} |
41 |
|
|
LIBSPOPC_UP = 1; |
42 |
|
|
return 0; /* FIXME */ |
43 |
|
|
} |
44 |
|
|
|
45 |
|
|
/* clean libspopc, thus re-initable by libspopc_init() */ |
46 |
ben |
6 |
DLLIMPORT int libspopc_clean(void) |
47 |
ben |
1 |
{ |
48 |
|
|
if(LIBSPOPC_UP) |
49 |
|
|
{ |
50 |
|
|
/* clean all mutexes */ |
51 |
|
|
mutex_clean(&GETHOSTBYNAME); |
52 |
|
|
} |
53 |
|
|
LIBSPOPC_UP = 0; |
54 |
|
|
return 0; /* FIXME */ |
55 |
|
|
} |
56 |
|
|
|