reSIProcate
SIP stack, Dialog Usage Manager and related libraries
Loading...
Searching...
No Matches
DnsNaptrRecord.hxx
Go to the documentation of this file.
1#ifndef RESIP_DNS_NAPTR_RECORD
2#define RESIP_DNS_NAPTR_RECORD
3
4#include "rutil/Data.hxx"
5#include "rutil/Socket.hxx"
8
9namespace resip
10{
11
12class Data;
13class DnsResourceRecord;
14class RROverlay;
15class BaseException;
16
18{
19 public:
20 class NaptrException final : public BaseException
21 {
22 public:
23 NaptrException(const Data& msg, const Data& file, const int line)
24 : BaseException(msg, file, line)
25 {
26 }
27
28 const char* name() const noexcept override { return "NaptrException"; }
29 };
30
31 class RegExp
32 {
33 public:
34 // Takes a regexp expression as defined in rfc 2915 (section 3
35 // Substitution Expression Grammar) The delimiter is whatever
36 // appears in the first character. This can be empty.
37 RegExp(const Data& data);
38 RegExp();
39 ~RegExp();
40
41 bool empty() const;
42
43 // Convenience method provided for access to the antecedent of the
44 // regexp (the matching regular expression)
45 const Data& regexp() const;
46
47 // Convenience method provided for access to the consequent of the
48 // regexp (the replacement) - this must be a URI
49 const Data& replacement() const;
50
51 // Applies the regular expression substitution based on the input
52 // string. Will return Data::Empty if the input does not match the
53 // substitution.
54 Data apply(const Data& input) const;
55
56 private:
57 Data mRegexp;
58 Data mReplacement;
59 Data flags;
60 //regex_t mRe;
61 };
62
63
64 DnsNaptrRecord() : mOrder(-1), mPreference(-1), mTTL(-1) {}
66 virtual ~DnsNaptrRecord() {}
67
68 // accessors.
69 int order() const { return mOrder; }
70 int& order() { return mOrder; }
71 int preference() const { return mPreference; }
72 const Data& flags() const { return mFlags; }
73 const Data& service() const { return mService; }
74 const RegExp& regexp() const { return mRegexp; }
75 const Data& replacement() const { return mReplacement; }
76 virtual const Data& name() const { return mName; }
77 virtual int ttl() const { return mTTL; }
78 virtual bool isSameValue(const Data& value) const;
79 virtual EncodeStream& dump(EncodeStream& strm) const;
80
81 private:
82 int mOrder;
83 int mPreference;
84 Data mFlags;
85 Data mService;
86 RegExp mRegexp;
87 Data mReplacement;
88 Data mName;
89 int mTTL;
90};
91
92}
93
94
95#endif
96
97/* ====================================================================
98 * The Vovida Software License, Version 1.0
99 *
100 * Copyright (c) 2000-2005 Vovida Networks, Inc. All rights reserved.
101 *
102 * Redistribution and use in source and binary forms, with or without
103 * modification, are permitted provided that the following conditions
104 * are met:
105 *
106 * 1. Redistributions of source code must retain the above copyright
107 * notice, this list of conditions and the following disclaimer.
108 *
109 * 2. Redistributions in binary form must reproduce the above copyright
110 * notice, this list of conditions and the following disclaimer in
111 * the documentation and/or other materials provided with the
112 * distribution.
113 *
114 * 3. The names "VOCAL", "Vovida Open Communication Application Library",
115 * and "Vovida Open Communication Application Library (VOCAL)" must
116 * not be used to endorse or promote products derived from this
117 * software without prior written permission. For written
118 * permission, please contact vocal@vovida.org.
119 *
120 * 4. Products derived from this software may not be called "VOCAL", nor
121 * may "VOCAL" appear in their name, without prior written
122 * permission of Vovida Networks, Inc.
123 *
124 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
125 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
126 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
127 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA
128 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
129 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
130 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
131 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
132 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
133 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
134 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
135 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
136 * DAMAGE.
137 *
138 * ====================================================================
139 *
140 * This software consists of voluntary contributions made by Vovida
141 * Networks, Inc. and many individuals on behalf of Vovida Networks,
142 * Inc. For more information on Vovida Networks, Inc., please see
143 * <http://www.vovida.org/>.
144 *
145 */
Handles cross-platform sockets compatibility.
The abstract base-class for all exceptions thrown by resip code.
An alternative to std::string, encapsulates an arbitrary buffer of bytes.
Definition Data.hxx:90
const char * name() const noexcept override
NaptrException(const Data &msg, const Data &file, const int line)
Data apply(const Data &input) const
const Data & replacement() const
const RegExp & regexp() const
virtual const Data & name() const
const Data & service() const
virtual EncodeStream & dump(EncodeStream &strm) const
virtual int ttl() const
const Data & replacement() const
virtual bool isSameValue(const Data &value) const
const Data & flags() const
dcm! – add UnusedChecking(_enum) below;
#define EncodeStream