libspf2
1.2.10
Main Page
Data Structures
Files
File List
Globals
src
include
spf_response.h
Go to the documentation of this file.
1
/*
2
* This program is free software; you can redistribute it and/or modify
3
* it under the terms of either:
4
*
5
* a) The GNU Lesser General Public License as published by the Free
6
* Software Foundation; either version 2.1, or (at your option) any
7
* later version,
8
*
9
* OR
10
*
11
* b) The two-clause BSD license.
12
*
13
* These licenses can be found with the distribution in the file LICENSES
14
*/
15
16
#ifndef INC_SPF_RESPONSE
17
#define INC_SPF_RESPONSE
18
78
typedef
79
enum
SPF_result_enum {
80
SPF_RESULT_INVALID
= 0,
81
SPF_RESULT_NEUTRAL
,
82
SPF_RESULT_PASS
,
83
SPF_RESULT_FAIL
,
84
SPF_RESULT_SOFTFAIL
,
85
86
SPF_RESULT_NONE
,
87
SPF_RESULT_TEMPERROR
,
88
SPF_RESULT_PERMERROR
89
}
SPF_result_t
;
90
99
typedef
100
enum
SPF_reason_enum {
101
SPF_REASON_NONE
= 0
102
,
SPF_REASON_FAILURE
103
,
SPF_REASON_LOCALHOST
104
,
SPF_REASON_LOCAL_POLICY
105
,
SPF_REASON_MECH
106
,
SPF_REASON_DEFAULT
107
,
SPF_REASON_2MX
108
}
SPF_reason_t
;
109
118
typedef
119
enum
SPF_errcode_t
{
120
SPF_E_SUCCESS
= 0
121
,
SPF_E_NO_MEMORY
122
,
SPF_E_NOT_SPF
123
,
SPF_E_SYNTAX
124
,
SPF_E_MOD_W_PREF
125
,
SPF_E_INVALID_CHAR
126
,
SPF_E_UNKNOWN_MECH
127
,
SPF_E_INVALID_OPT
128
,
SPF_E_INVALID_CIDR
129
,
SPF_E_MISSING_OPT
130
,
SPF_E_INTERNAL_ERROR
131
,
SPF_E_INVALID_ESC
132
,
SPF_E_INVALID_VAR
133
,
SPF_E_BIG_SUBDOM
134
,
SPF_E_INVALID_DELIM
135
,
SPF_E_BIG_STRING
136
,
SPF_E_BIG_MECH
137
,
SPF_E_BIG_MOD
138
,
SPF_E_BIG_DNS
139
,
SPF_E_INVALID_IP4
140
,
SPF_E_INVALID_IP6
141
,
SPF_E_INVALID_PREFIX
142
,
SPF_E_RESULT_UNKNOWN
143
,
SPF_E_UNINIT_VAR
144
,
SPF_E_MOD_NOT_FOUND
145
,
SPF_E_NOT_CONFIG
146
,
SPF_E_DNS_ERROR
147
,
SPF_E_BAD_HOST_IP
148
,
SPF_E_BAD_HOST_TLD
149
,
SPF_E_MECH_AFTER_ALL
151
,
SPF_E_INCLUDE_RETURNED_NONE
152
,
SPF_E_RECURSIVE
153
,
SPF_E_MULTIPLE_RECORDS
154
}
SPF_errcode_t
;
155
156
typedef
157
struct
SPF_error_struct
158
{
159
SPF_errcode_t
code
;
160
char
*
message
;
161
char
is_error
;
162
}
SPF_error_t
;
163
164
typedef
struct
SPF_response_struct
SPF_response_t;
165
166
#include "
spf.h
"
167
#include "
spf_request.h
"
168
169
struct
SPF_response_struct
{
170
/* Structure variables */
171
SPF_request_t *
spf_request
;
172
SPF_record_t *
spf_record_exp
;
173
174
/* The answer itself. */
175
SPF_result_t
result
;
176
SPF_reason_t
reason
;
177
SPF_errcode_t
err
;
178
179
char
*
received_spf
;
180
char
*
received_spf_value
;
181
char
*
header_comment
;
182
char
*
smtp_comment
;
183
char
*
explanation
;
184
185
/* The errors */
186
SPF_error_t
*
errors
;
187
unsigned
short
errors_size
;
188
unsigned
short
errors_length
;
189
unsigned
short
num_errors
;
191
/* Stuff which lets us get there. */
192
int
num_dns_mech
;
193
};
194
195
196
SPF_response_t *
SPF_response_new
(SPF_request_t *spf_request);
197
void
SPF_response_free
(SPF_response_t *rp);
198
SPF_response_t *
SPF_response_combine
(SPF_response_t *
main
,
199
SPF_response_t *r2mx);
200
201
/* Query functions for elements of the result */
202
SPF_result_t
SPF_response_result
(SPF_response_t *rp);
203
SPF_reason_t
SPF_response_reason
(SPF_response_t *rp);
204
SPF_errcode_t
SPF_response_errcode
(SPF_response_t *rp);
205
const
char
*
SPF_response_get_received_spf
(SPF_response_t *rp);
206
const
char
*
SPF_response_get_received_spf_value
(SPF_response_t*rp);
207
const
char
*
SPF_response_get_header_comment
(SPF_response_t *rp);
208
const
char
*
SPF_response_get_smtp_comment
(SPF_response_t *rp);
209
const
char
*
SPF_response_get_explanation
(SPF_response_t *rp);
210
212
int
SPF_response_messages
(SPF_response_t *rp);
214
int
SPF_response_errors
(SPF_response_t *rp);
216
int
SPF_response_warnings
(SPF_response_t *rp);
218
SPF_error_t
*
SPF_response_message
(SPF_response_t *rp,
int
idx);
219
220
SPF_errcode_t
SPF_error_code
(
SPF_error_t
*err);
221
const
char
*
SPF_error_message
(
SPF_error_t
*err);
222
char
SPF_error_errorp
(
SPF_error_t
*err);
223
226
SPF_errcode_t
SPF_response_add_error_ptr
(SPF_response_t *rp,
227
SPF_errcode_t
code,
228
const
char
*text,
const
char
*tptr,
229
const
char
*format, ...);
230
SPF_errcode_t
SPF_response_add_error_idx
(SPF_response_t *rp,
231
SPF_errcode_t
code,
232
const
char
*text,
int
idx,
233
const
char
*format, ...);
234
SPF_errcode_t
SPF_response_add_error
(SPF_response_t *rp,
235
SPF_errcode_t
code,
236
const
char
*format, ...);
237
SPF_errcode_t
SPF_response_add_warn_ptr
(SPF_response_t *rp,
238
SPF_errcode_t
code,
239
const
char
*text,
const
char
*tptr,
240
const
char
*format, ...);
241
SPF_errcode_t
SPF_response_add_warn_idx
(SPF_response_t *rp,
242
SPF_errcode_t
code,
243
const
char
*text,
int
idx,
244
const
char
*format, ...);
245
SPF_errcode_t
SPF_response_add_warn
(SPF_response_t *rp,
246
SPF_errcode_t
code,
247
const
char
*format, ...);
248
249
#endif
Generated by
1.8.3.1