root/apps/iphone/superbook/trunk/DotTel_SDK/Classes/RecordTxt.h
@
719
| Revision 546, 3.9 kB (checked in by henri, 4 years ago) |
|---|
| Line | |
|---|---|
| 1 | // |
| 2 | // RecordTxt.h |
| 3 | // DotTel SDK |
| 4 | // |
| 5 | // Created by Henri Asseily on 9/13/08. |
| 6 | /* |
| 7 | Copyright (c) 2008-2009, Telnic Ltd. All rights reserved. |
| 8 | |
| 9 | Redistribution and use in source and binary forms, with or without modification, |
| 10 | are permitted provided that the following conditions are met: |
| 11 | |
| 12 | Redistributions of source code must retain the above copyright notice, this list of conditions |
| 13 | and the following disclaimer. Redistributions in binary form must reproduce the above copyright |
| 14 | notice, this list of conditions and the following disclaimer in the documentation and/or other |
| 15 | materials provided with the distribution. |
| 16 | Neither the name of the Telnic Ltd. nor the names of its contributors may be used to endorse or |
| 17 | promote products derived from this software without specific prior written permission. |
| 18 | THIS DOCUMENTATION IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS |
| 19 | OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY |
| 20 | AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR |
| 21 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| 22 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 23 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER |
| 24 | IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 25 | OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 26 | */ |
| 27 | // |
| 28 | |
| 29 | #import <UIKit/UIKit.h> |
| 30 | #import <ldns/ldns.h> |
| 31 | |
| 32 | // Shorthand for getting localized strings |
| 33 | #define LocTelStr(key) [[NSBundle mainBundle] localizedStringForKey:(key) value:@"" table:@"DotTel"] |
| 34 | |
| 35 | enum RecordTxtSubTypes { |
| 36 | RecordTxtSubTypeString = 0, // string header (will be made obsolete by NINFO) |
| 37 | RecordTxtSubTypeDDS = 1, // domain display string |
| 38 | RecordTxtSubTypeKeyword = 2, // keyword |
| 39 | RecordTxtSubTypeOtherTSM = 3, // other .tel system message |
| 40 | RecordTxtSubTypeAdvert = 4, // .tad advert |
| 41 | RecordTxtSubTypeLabel = 5, // .tlb record label |
| 42 | }; |
| 43 | |
| 44 | @interface RecordTxt : NSObject { |
| 45 | |
| 46 | BOOL isValid; |
| 47 | NSUInteger subType; // RecordTxtSubTypes value |
| 48 | |
| 49 | // Derived attributes |
| 50 | NSString *primaryDescription; // primary keyword type description (nl, pa, ...) |
| 51 | NSString *primaryValue; // primary keyword value |
| 52 | NSString *textValue; // string value of the TXT record |
| 53 | NSMutableArray *keysAndValues; // all keys and values of the TXT record (including primary key/value) |
| 54 | NSDate *expiryDate; // Expiry date of the record, based on time-to-live |
| 55 | NSInteger order; |
| 56 | NSInteger preference; |
| 57 | } |
| 58 | |
| 59 | /** |
| 60 | * Class method to initialize a TXT record from a ldns resource record |
| 61 | * This method calls recordWithRr:date: using the current date and time |
| 62 | * |
| 63 | * @return the record |
| 64 | */ |
| 65 | + (id)recordWithRr:(ldns_rr *)rr; |
| 66 | |
| 67 | /** |
| 68 | * Class method to initialize a TXT record from a ldns resource record |
| 69 | * Sets property isValid=NO on error or if the provided ldns rr is not a TXT. |
| 70 | * |
| 71 | * @return the record |
| 72 | */ |
| 73 | + (id)recordWithRr:(ldns_rr *)rr date:(NSDate *)lookupDate; |
| 74 | |
| 75 | /** |
| 76 | * Initializer for a TXT record from a ldns resource record |
| 77 | * Sets property isValid=NO on error or if the provided ldns rr is not a TXT. |
| 78 | * You shouldn't need to call this directly. Instead call the class method |
| 79 | * recordWithRr. |
| 80 | * |
| 81 | * @return the record |
| 82 | */ |
| 83 | - (id)initWithRr:(ldns_rr *)rr date:(NSDate *)lookupDate; |
| 84 | |
| 85 | @property (readonly) BOOL isValid; |
| 86 | @property (readonly) NSUInteger subType; |
| 87 | |
| 88 | @property (readonly, nonatomic, retain) NSString *primaryDescription; |
| 89 | @property (readonly, nonatomic, retain) NSString *primaryValue; |
| 90 | @property (readonly, nonatomic, retain) NSString *textValue; |
| 91 | @property (readonly, nonatomic, retain) NSMutableArray *keysAndValues; |
| 92 | @property (readonly, nonatomic, retain) NSDate *expiryDate; |
| 93 | @property (readonly) NSInteger order; |
| 94 | @property (readonly) NSInteger preference; |
| 95 | |
| 96 | @end |
Note: See TracBrowser
for help on using the browser.








