|
Wired Networking
2.0
Wired Networking is an Objective-C implementation of the Wired protocol for Mac OS X
|
00001 /* $Id$ */ 00002 00003 /* 00004 * Copyright (c) 2008-2009 Axel Andersson 00005 * All rights reserved. 00006 * 00007 * Redistribution and use in source and binary forms, with or without 00008 * modification, are permitted provided that the following conditions 00009 * are met: 00010 * 1. Redistributions of source code must retain the above copyright 00011 * notice, this list of conditions and the following disclaimer. 00012 * 2. Redistributions in binary form must reproduce the above copyright 00013 * notice, this list of conditions and the following disclaimer in the 00014 * documentation and/or other materials provided with the distribution. 00015 * 00016 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 00017 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 00018 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00019 * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 00020 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 00021 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 00022 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 00023 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 00024 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 00025 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00026 * POSSIBILITY OF SUCH DAMAGE. 00027 */ 00028 00029 #import <WiredNetworking/WIP7Message.h> 00030 00031 enum _WIP7Originator { 00032 WIP7Both = WI_P7_BOTH, 00033 WIP7Client = WI_P7_CLIENT, 00034 WIP7Server = WI_P7_SERVER 00035 }; 00036 typedef enum _WIP7Originator WIP7Originator; 00037 00038 00039 @class WIP7SpecMessage, WIP7Message, WIError; 00040 00041 @interface WIP7Spec : WIObject { 00042 wi_p7_spec_t *_spec; 00043 00044 CFMutableDictionaryRef _fieldNames; 00045 CFMutableDictionaryRef _fieldIDs; 00046 00047 NSMutableArray *_fields; 00048 NSMutableArray *_messages; 00049 NSMutableDictionary *_parameters; 00050 } 00051 00052 - (id)initWithPath:(NSString *)path originator:(WIP7Originator)originator error:(WIError **)error; 00053 - (id)initWithString:(NSString *)string originator:(WIP7Originator)originator error:(WIError **)error; 00054 00055 - (wi_p7_spec_t *)spec; 00056 - (NSString *)protocolName; 00057 - (NSString *)protocolVersion; 00058 00059 - (wi_string_t *)fieldNameForName:(NSString *)name; 00060 - (NSUInteger)fieldIDForName:(NSString *)name; 00061 00062 - (NSArray *)fields; 00063 - (NSArray *)messages; 00064 - (WIP7SpecMessage *)messageWithName:(NSString *)name; 00065 00066 - (BOOL)verifyMessage:(WIP7Message *)message error:(WIError **)error; 00067 00068 @end 00069 00070 00071 @interface WIP7SpecType : WIObject { 00072 wi_p7_spec_type_t *_type; 00073 NSString *_name; 00074 WIP7Type _id; 00075 } 00076 00077 - (NSComparisonResult)compare:(WIP7SpecType *)type; 00078 00079 - (wi_p7_spec_type_t *)type; 00080 - (NSString *)name; 00081 - (WIP7Type)ID; 00082 00083 @end 00084 00085 00086 @interface WIP7SpecField : WIObject { 00087 wi_p7_spec_field_t *_field; 00088 NSString *_name; 00089 NSUInteger _id; 00090 WIP7SpecType *_type; 00091 NSMutableDictionary *_enumsByName; 00092 NSMutableDictionary *_enumsByValue; 00093 } 00094 00095 - (NSComparisonResult)compare:(WIP7SpecField *)field; 00096 00097 - (wi_p7_spec_field_t *)field; 00098 - (NSString *)name; 00099 - (NSUInteger)ID; 00100 - (WIP7SpecType *)type; 00101 - (NSDictionary *)enumsByName; 00102 - (NSDictionary *)enumsByValue; 00103 00104 @end 00105 00106 00107 @interface WIP7SpecMessage : WIObject { 00108 wi_p7_spec_message_t *_message; 00109 NSString *_name; 00110 NSUInteger _id; 00111 NSMutableArray *_parameters; 00112 } 00113 00114 - (NSComparisonResult)compare:(WIP7SpecMessage *)message; 00115 00116 - (wi_p7_spec_message_t *)message; 00117 - (NSString *)name; 00118 - (NSUInteger)ID; 00119 - (NSArray *)parameters; 00120 00121 @end 00122 00123 00124 @interface WIP7SpecParameter : WIObject { 00125 wi_p7_spec_parameter_t *_parameter; 00126 WIP7SpecField *_field; 00127 BOOL _required; 00128 } 00129 00130 - (NSComparisonResult)compare:(WIP7SpecParameter *)parameter; 00131 00132 - (wi_p7_spec_parameter_t *)parameter; 00133 - (WIP7SpecField *)field; 00134 - (BOOL)isRequired; 00135 00136 @end
1.7.6.1