00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #include "spf_sys_config.h"
00017
00018
00019
00020 #ifdef STDC_HEADERS
00021 # include <stdio.h>
00022 # include <stdlib.h>
00023 # include <ctype.h>
00024 #endif
00025
00026 #ifdef HAVE_INTTYPES_H
00027 #include <inttypes.h>
00028 #endif
00029
00030 #ifdef HAVE_STRING_H
00031 # include <string.h>
00032 #else
00033 # ifdef HAVE_STRINGS_H
00034 # include <strings.h>
00035 # endif
00036 #endif
00037
00038
00039 #include "spf.h"
00040 #include "spf_internal.h"
00041
00042
00043
00044 SPF_errcode_t
00045 SPF_record_print(SPF_record_t *spf_record)
00046 {
00047 char *prt_buf = NULL;
00048 size_t prt_len = 0;
00049 int err;
00050
00051 if (spf_record == NULL) {
00052 SPF_info("SPF header: <null record>");
00053 SPF_info("Unknown");
00054 return SPF_E_SUCCESS;
00055 }
00056
00057 SPF_infof( "SPF header: version: %d mech %d/%u mod %d/%u len=%u",
00058 spf_record->version,
00059 (int)spf_record->num_mech, (unsigned int)spf_record->mech_len,
00060 (int)spf_record->num_mod, (unsigned int)spf_record->mod_len,
00061 (unsigned int)(sizeof(SPF_record_t)
00062 + spf_record->mech_len
00063 + spf_record->mod_len));
00064
00065 err = SPF_record_stringify(spf_record, &prt_buf, &prt_len);
00066 if ( err == SPF_E_RESULT_UNKNOWN )
00067 SPF_info( "Unknown" );
00068 else if ( err )
00069 SPF_infof( "SPF_record_stringify error: %s (%d)", SPF_strerror( err ), err );
00070 else
00071 SPF_infof( "SPF record: %s", prt_buf );
00072
00073 if ( prt_buf )
00074 free( prt_buf );
00075 return SPF_E_SUCCESS;
00076 }
00077
00078
00079
00080
00081
00082 void SPF_print_sizeof(void)
00083 {
00084
00085 SPF_infof( "sizeof(SPF_mech_t)=%lu", (unsigned long)sizeof(SPF_mech_t));
00086 SPF_infof( "sizeof(SPF_data_t)=%lu", (unsigned long)sizeof(SPF_data_t));
00087 SPF_infof( "sizeof(SPF_mod_t)=%lu", (unsigned long)sizeof(SPF_mod_t));
00088 }