|
Wired Networking
2.0
Objective-C implementation of the Wired 2.0 protocol
|
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 typedef wi_p7_boolean_t WIP7Bool; 00030 typedef wi_p7_enum_t WIP7Enum; 00031 typedef wi_p7_int32_t WIP7Int32; 00032 typedef wi_p7_uint32_t WIP7UInt32; 00033 typedef wi_p7_int64_t WIP7Int64; 00034 typedef wi_p7_uint64_t WIP7UInt64; 00035 typedef wi_p7_double_t WIP7Double; 00036 typedef wi_p7_oobdata_t WIP7OOBData; 00037 00038 00039 enum _WIP7Type { 00040 WIP7BoolType = WI_P7_BOOL, 00041 WIP7EnumType = WI_P7_ENUM, 00042 WIP7Int32Type = WI_P7_INT32, 00043 WIP7UInt32Type = WI_P7_UINT32, 00044 WIP7Int64Type = WI_P7_INT64, 00045 WIP7UInt64Type = WI_P7_UINT64, 00046 WIP7DoubleType = WI_P7_DOUBLE, 00047 WIP7StringType = WI_P7_STRING, 00048 WIP7UUIDType = WI_P7_UUID, 00049 WIP7DateType = WI_P7_DATE, 00050 WIP7DataType = WI_P7_DATA, 00051 WIP7OOBDataType = WI_P7_OOBDATA, 00052 WIP7ListType = WI_P7_LIST 00053 }; 00054 typedef enum _WIP7Type WIP7Type; 00055 00056 enum _WIP7Serialization { 00057 WIP7Unknown = WI_P7_UNKNOWN, 00058 WIP7XML = WI_P7_XML, 00059 WIP7Binary = WI_P7_BINARY 00060 }; 00061 typedef enum _WIP7Serialization WIP7Serialization; 00062 00063 00064 @class WIP7Socket, WIP7Spec; 00065 00066 @interface WIP7Message : WIObject { 00067 wi_p7_message_t *_message; 00068 NSString *_name; 00069 WIP7Spec *_spec; 00070 void *_contextInfo; 00071 } 00072 00073 + (id)messageWithName:(NSString *)name spec:(WIP7Spec *)spec; 00074 + (id)messageWithMessage:(wi_p7_message_t *)message spec:(WIP7Spec *)spec; 00075 00076 - (id)initWithName:(NSString *)name spec:(WIP7Spec *)spec; 00077 - (id)initWithMessage:(wi_p7_message_t *)message spec:(WIP7Spec *)spec; 00078 00079 - (NSString *)name; 00080 - (wi_p7_message_t *)message; 00081 00082 - (void)setContextInfo:(void *)contextInfo; 00083 - (void *)contextInfo; 00084 00085 - (NSDictionary *)fields; 00086 00087 - (BOOL)getBool:(WIP7Bool *)value forName:(NSString *)name; 00088 - (BOOL)setBool:(WIP7Bool)value forName:(NSString *)name; 00089 - (BOOL)getEnum:(WIP7Enum *)value forName:(NSString *)name; 00090 - (BOOL)setEnum:(WIP7Enum)value forName:(NSString *)name; 00091 - (BOOL)getInt32:(WIP7Int32 *)value forName:(NSString *)name; 00092 - (BOOL)setInt32:(WIP7Int32)value forName:(NSString *)name; 00093 - (BOOL)getUInt32:(WIP7UInt32 *)value forName:(NSString *)name; 00094 - (BOOL)setUInt32:(WIP7UInt32)value forName:(NSString *)name; 00095 - (BOOL)getInt64:(WIP7Int64 *)value forName:(NSString *)name; 00096 - (BOOL)setInt64:(WIP7Int64)value forName:(NSString *)name; 00097 - (BOOL)getUInt64:(WIP7UInt64 *)value forName:(NSString *)name; 00098 - (BOOL)setUInt64:(WIP7UInt64)value forName:(NSString *)name; 00099 - (BOOL)getDouble:(WIP7Double *)value forName:(NSString *)name; 00100 - (BOOL)setDouble:(WIP7Double)value forName:(NSString *)name; 00101 - (BOOL)getOOBData:(WIP7OOBData *)value forName:(NSString *)name; 00102 - (BOOL)setOOBData:(WIP7OOBData)value forName:(NSString *)name; 00103 00104 - (BOOL)setString:(NSString *)string forName:(NSString *)name; 00105 - (NSString *)stringForName:(NSString *)name; 00106 - (BOOL)setData:(NSData *)data forName:(NSString *)name; 00107 - (NSData *)dataForName:(NSString *)name; 00108 - (BOOL)setNumber:(NSNumber *)number forName:(NSString *)name; 00109 - (NSNumber *)numberForName:(NSString *)name; 00110 - (BOOL)setEnumName:(NSString *)enumName forName:(NSString *)name; 00111 - (NSString *)enumNameForName:(NSString *)name; 00112 - (BOOL)setDate:(NSDate *)date forName:(NSString *)name; 00113 - (NSDate *)dateForName:(NSString *)name; 00114 - (BOOL)setUUID:(NSString *)string forName:(NSString *)name; 00115 - (NSString *)UUIDForName:(NSString *)name; 00116 - (BOOL)setList:(NSArray *)list forName:(NSString *)name; 00117 - (NSArray *)listForName:(NSString *)name; 00118 00119 @end