The Netsukuku Project  0.0.9
An Alternative routing method
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
err_errno.h
Go to the documentation of this file.
1  /**************************************
2  * AUTHOR: Federico Tomassini *
3  * Copyright (C) Federico Tomassini *
4  * Contact effetom@gmail.com *
5  ***********************************************
6  ***** ******
7 *************************************************************************
8 * *
9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
13 * *
14 * This program is distributed in the hope that it will be useful, *
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
17 * GNU General Public License for more details. *
18 * *
19 ************************************************************************/
20 
21 
22 #ifndef ERR_ERRNO_H
23 #define ERR_ERRNO_H
24 
25 #include <errno.h>
26 #include <string.h>
27 #include <stdlib.h>
28 
29 #define ERR_UFOERR -1
30 #define ERR_DNSMLO -2
31 #define ERR_DNSMSL -3
32 #define ERR_DNSMDP -4
33 #define ERR_DNSMDD -5
34 #define ERR_DNSTRP -6
35 #define ERR_DNSPLB -7
36 #define ERR_DNSPTP -8
37 #define ERR_DNSMDA -9
38 #define ERR_DNSPDS -10
39 
40 #define ERR_ANDMAP -11
41 #define ERR_ANDPLB -12
42 #define ERR_ANDMAD -13
43 #define ERR_ANDNCQ -14
44 
45 #define ERR_RSLERC -15
46 #define ERR_RSLAIE -16
47 #define ERR_RSLNNS -17
48 #define ERR_RSLFDQ -18
49 #define ERR_RSLRSL -19
50 #define ERR_RSLAQD -20
51 
52 #define ERR_MRKINI -21
53 #define ERR_NETFIL -22
54 #define ERR_NETRUL -23
55 #define ERR_NETCOM -24
56 #define ERR_NETCHA -25
57 #define ERR_NETDEL -26
58 #define ERR_NETSTO -27
59 #define ERR_NETRST -28
60 
61 #define ERR_SNDMRF -29
62 #define ERR_SNDRCS -30
63 
64 #define ERR_ZLIBCP -31
65 #define ERR_ZLIBUP -32
66 #define ERR_ZLIBNU -33
67 
68 #define ERR_TOTAL_ERRS (-(ERR_ZLIBNU))
69 #define ERR_OVERFLOW "Error number does not exist."
70 
71  /* END OF DEFS */
72 
73 
74  /*
75  * Core
76  */
77 const char *err_func,*err_file;
78 #define ERR_NERR (ERR_TOTAL_ERRS)
79 #define err_seterrno(n) errno=(n);err_func=__func__; \
80  err_file=__FILE__
81 #define err_ret(n,ret) {err_seterrno(n);return ret;}
82 #define err_intret(n) {err_seterrno(n);return -1;}
83 #define err_voidret(n) {err_seterrno(n);return NULL;}
84 #define err_strerror(e) \
85  ((e)>=0)? \
86  strerror(e): \
87  __err_strerror(e)
88 #define ERR_FORMAT "In %s(): %s() returns -> %s"
89 #define err_str ERR_FORMAT,__func__, \
90  err_func,__err_strerror(errno)
91 
92 
93 const char *__err_strerror(int n);
94 
95 #endif /* ERR_ERRNO_H */
const char * err_file
Definition: err_errno.h:77
const char * __err_strerror(int n)
Definition: err_errno.c:64
const char * err_func
Definition: err_errno.h:77