dns.h

Go to the documentation of this file.
00001 00002 /* libspf - Sender Policy Framework library 00003 * 00004 * ANSI C implementation of draft-mengwong-spf-02.9.7.txt 00005 * 00006 * Author: James Couzens <jcouzens@6o4.ca> 00007 * Author: Sean Comeau <scomeau@obscurity.org> 00008 * 00009 * FILE: dns.h 00010 * DESC: dns functions header file 00011 * 00012 * License: 00013 * 00014 * The libspf Software License, Version 1.0 00015 * 00016 * Copyright (c) 2004 James Couzens & Sean Comeau All rights 00017 * reserved. 00018 * 00019 * Redistribution and use in source and binary forms, with or without 00020 * modification, are permitted provided that the following conditions 00021 * are met: 00022 * 00023 * 1. Redistributions of source code must retain the above copyright 00024 * notice, this list of conditions and the following disclaimer. 00025 * 00026 * 2. Redistributions in binary form must reproduce the above copyright 00027 * notice, this list of conditions and the following disclaimer in 00028 * the documentation and/or other materials provided with the 00029 * distribution. 00030 * 00031 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED 00032 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 00033 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00034 * DISCLAIMED. IN NO EVENT SHALL THE AUTHORS MAKING USE OF THIS LICESEN 00035 * OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 00036 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 00037 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF 00038 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 00039 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 00040 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 00041 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 00042 * SUCH DAMAGE. 00043 * 00044 */ 00045 00046 #ifndef _DNS_H 00047 #define _DNS_H 1 00048 00049 #include <stdio.h> 00050 #include <string.h> 00051 #include <strings.h> 00052 #include <sys/socket.h> /* inet_ functions / structs */ 00053 #include <netinet/in.h> /* inet_ functions / structs */ 00054 #include <arpa/nameser.h> /* DNS HEADER struct */ 00055 #include <resolv.h> /* dn_skipname */ 00056 #include <netdb.h> 00057 #include <arpa/inet.h> /* in_addr struct */ 00058 00059 __BEGIN_DECLS 00060 00061 /* 00062 * For reference purposes commented out are the constants based on 00063 * RFC 883, RFC 1034, RFC 1035. Because we're working with IN_TXT 00064 * records we will use a larger packet size at 65536 bytes which 00065 * is likey to cover most circumstances. 00066 * 00067 * #define PACKETSZ 512 max response packet size 00068 * #define MAXDNAME 1025 max uncompressed IN_TXT record 00069 * #define MAXCDNAME 255 max compressed IN_TXT record 00070 * 00071 */ 00072 00073 #define SPF_PACKETSZ 8192 00074 #define SPF_MAXDNAME 1025 00075 #define SPF_MAXCDNAME 255 00076 00077 char *DNS_query(peer_info_t *peer_info, const char *s, const int T_TYPE, 00078 const char *mta); 00079 char *DNS_txt_answer(int16_t ancount, const u_char *msg_ptr, 00080 const u_char *eom_ptr, u_char *rd_ptr, char *buf, int *ttl); 00081 char *DNS_mx_answer(int16_t ancount, const u_char *msg_ptr, 00082 const u_char *eom_ptr, u_char *rd_ptr, char *buf, int *ttl); 00083 SPF_BOOL DNS_ptr_answer(peer_info_t *peer_info, int16_t ancount, 00084 const u_char *msg_ptr, const u_char *eom_ptr, u_char *rd_ptr, char *buf, 00085 const char *mta, int *ttl); 00086 char *DNS_cname_answer(int16_t ancount, const u_char *msg_ptr, 00087 const u_char *eom_ptr, u_char *rd_ptr, char *buf, int *ttl); 00088 00089 __END_DECLS 00090 00091 #endif /* _DNS_H */ 00092 00093 /* end dns.h */

Generated on Thu Jul 1 14:05:44 2004 for libspf v1.0 by doxygen 1.3.7