/[resiprocate]/branches/b-directory-reorg/sip/resiprocate/LocalDns.hxx
ViewVC logotype

Contents of /branches/b-directory-reorg/sip/resiprocate/LocalDns.hxx

Parent Directory Parent Directory | Revision Log Revision Log


Revision 5271 - (show annotations) (download)
Thu Aug 18 23:43:07 2005 UTC (14 years, 3 months ago) by jason
File size: 4366 byte(s)
new directory reorg proposal
1 #if !defined(RESIP_LOCAL_DNS_HXX)
2 #define RESIP_LOCAL_DNS_HXX
3
4 #include "resiprocate/os/Data.hxx"
5 #include "resiprocate/os/Tuple.hxx"
6 #include "resiprocate/external/ExternalDns.hxx"
7
8
9 extern "C"
10 {
11 struct ares_channeldata;
12 }
13
14
15 namespace resip
16 {
17 class LocalDns : public ExternalDns
18 {
19 public:
20 LocalDns();
21 virtual ~LocalDns();
22
23 virtual int init();
24 virtual bool requiresProcess();
25 virtual void buildFdSet(fd_set& read, fd_set& write, int& size);
26 virtual void process(fd_set& read, fd_set& write);
27
28 virtual void freeResult(ExternalDnsRawResult /* res */) {}
29 virtual void freeResult(ExternalDnsHostResult /* res */) {}
30
31 void lookup(const char* target, unsigned short type, ExternalDnsHandler* handler, void* userData);
32
33 virtual void lookupARecords(const char* target, ExternalDnsHandler* handler, void* userData) {}
34 virtual void lookupAAAARecords(const char* target, ExternalDnsHandler* handler, void* userData) {}
35 virtual void lookupNAPTR(const char* target, ExternalDnsHandler* handler, void* userData) {}
36 virtual void lookupSRV(const char* target, ExternalDnsHandler* handler, void* userData) {}
37 virtual char* errorMessage(long errorCode)
38 {
39 const char* msg = "Local Dns";
40
41 int len = strlen(msg);
42 char* errorString = new char[len+1];
43
44 strncpy(errorString, msg, len);
45 errorString[len] = '\0';
46 return errorString;
47 }
48
49 private:
50
51 struct ares_channeldata* mChannel;
52
53 typedef std::pair<ExternalDnsHandler*, void*> Payload;
54 static ExternalDnsRawResult makeRawResult(void *arg, int status, unsigned char *abuf, int alen);
55 static ExternalDnsHandler* getHandler(void* arg);
56
57 static void localCallback(void *arg, int status, unsigned char* abuf, int alen);
58
59 static void message(const char* file, unsigned char* buf, int& len);
60 static std::map<Data, Data> files;
61 static Data mTarget;
62 };
63
64 }
65
66 #endif
67
68 /* ====================================================================
69 * The Vovida Software License, Version 1.0
70 *
71 * Copyright (c) 2000-2005 Vovida Networks, Inc. All rights reserved.
72 *
73 * Redistribution and use in source and binary forms, with or without
74 * modification, are permitted provided that the following conditions
75 * are met:
76 *
77 * 1. Redistributions of source code must retain the above copyright
78 * notice, this list of conditions and the following disclaimer.
79 *
80 * 2. Redistributions in binary form must reproduce the above copyright
81 * notice, this list of conditions and the following disclaimer in
82 * the documentation and/or other materials provided with the
83 * distribution.
84 *
85 * 3. The names "VOCAL", "Vovida Open Communication Application Library",
86 * and "Vovida Open Communication Application Library (VOCAL)" must
87 * not be used to endorse or promote products derived from this
88 * software without prior written permission. For written
89 * permission, please contact vocal@vovida.org.
90 *
91 * 4. Products derived from this software may not be called "VOCAL", nor
92 * may "VOCAL" appear in their name, without prior written
93 * permission of Vovida Networks, Inc.
94 *
95 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
96 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
97 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
98 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA
99 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
100 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
101 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
102 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
103 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
104 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
105 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
106 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
107 * DAMAGE.
108 *
109 * ====================================================================
110 *
111 * This software consists of voluntary contributions made by Vovida
112 * Networks, Inc. and many individuals on behalf of Vovida Networks,
113 * Inc. For more information on Vovida Networks, Inc., please see
114 * <http://www.vovida.org/>.
115 *
116 */

webmaster AT resiprocate DOT org
ViewVC Help
Powered by ViewVC 1.1.27