root/WiredClient/trunk/WCConnection.h

Revision 5743, 5.5 kB (checked in by morris, 2 weeks ago)

Update for WiredNetworking?

  • Property svn:keywords set to author date id revision
Line 
1 /* $Id$ */
2
3 /*
4  *  Copyright (c) 2003-2007 Axel Andersson
5  *  All rights reserved.
6  *
7  *  Redistribution and use in source and binary forms, with or without
8  *  modification, are permitted provided that the following conditions
9  *  are met:
10  *  1. Redistributions of source code must retain the above copyright
11  *     notice, this list of conditions and the following disclaimer.
12  *  2. Redistributions in binary form must reproduce the above copyright
13  *     notice, this list of conditions and the following disclaimer in the
14  *     documentation and/or other materials provided with the distribution.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19  * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
20  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
24  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
25  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26  * POSSIBILITY OF SUCH DAMAGE.
27  */
28
29 #define WCServerProtocolVersion                 1.1
30 #define WCTrackerProtocolVersion                1.0
31
32 #define WCControlPort                                   2000
33 #define WCTransferPort                                  2001
34 #define WCTrackerPort                                   2002
35
36 #define WCBonjourName                                   @"_wired._tcp."
37
38 #define WCDefaultLogin                                  @"guest"
39
40 #define WCMessageSeparator                              @"\4"
41 #define WCFieldSeparator                                @"\34"
42 #define WCGroupSeparator                                @"\35"
43 #define WCRecordSeparator                               @"\36"
44
45 #define WCMessageLength                                 3
46
47 #define WCBanCommand                                    @"BAN"
48 #define WCBannerCommand                                 @"BANNER"
49 #define WCBroadcastCommand                              @"BROADCAST"
50 #define WCCategoriesCommand                             @"CATEGORIES"
51 #define WCClearNewsCommand                              @"CLEARNEWS"
52 #define WCClientCommand                                 @"CLIENT"
53 #define WCCommentCommand                                @"COMMENT"
54 #define WCCreateUserCommand                             @"CREATEUSER"
55 #define WCCreateGroupCommand                    @"CREATEGROUP"
56 #define WCDeclineCommand                                @"DECLINE"
57 #define WCDeleteCommand                                 @"DELETE"
58 #define WCDeleteUserCommand                             @"DELETEUSER"
59 #define WCDeleteGroupCommand                    @"DELETEGROUP"
60 #define WCDumpCommand                                   @"DUMP"
61 #define WCEditUserCommand                               @"EDITUSER"
62 #define WCEditGroupCommand                              @"EDITGROUP"
63 #define WCFolderCommand                                 @"FOLDER"
64 #define WCGetCommand                                    @"GET"
65 #define WCGroupsCommand                                 @"GROUPS"
66 #define WCHelloCommand                                  @"HELLO"
67 #define WCIconCommand                                   @"ICON"
68 #define WCInfoCommand                                   @"INFO"
69 #define WCInviteCommand                                 @"INVITE"
70 #define WCJoinCommand                                   @"JOIN"
71 #define WCKickCommand                                   @"KICK"
72 #define WCLeaveCommand                                  @"LEAVE"
73 #define WCListCommand                                   @"LIST"
74 #define WCListRecursiveCommand                  @"LISTRECURSIVE"
75 #define WCMeCommand                                             @"ME"
76 #define WCMoveCommand                                   @"MOVE"
77 #define WCMessageCommand                                @"MSG"
78 #define WCNewsCommand                                   @"NEWS"
79 #define WCNickCommand                                   @"NICK"
80 #define WCPassCommand                                   @"PASS"
81 #define WCPingCommand                                   @"PING"
82 #define WCPostCommand                                   @"POST"
83 #define WCPrivateChatCommand                    @"PRIVCHAT"
84 #define WCPrivilegesCommand                             @"PRIVILEGES"
85 #define WCPutCommand                                    @"PUT"
86 #define WCReadUserCommand                               @"READUSER"
87 #define WCReadGroupCommand                              @"READGROUP"
88 #define WCSayCommand                                    @"SAY"
89 #define WCSearchCommand                                 @"SEARCH"
90 #define WCServersCommand                                @"SERVERS"
91 #define WCStatCommand                                   @"STAT"
92 #define WCStatusCommand                                 @"STATUS"
93 #define WCTopicCommand                                  @"TOPIC"
94 #define WCTransferCommand                               @"TRANSFER"
95 #define WCTypeCommand                                   @"TYPE"
96 #define WCUserCommand                                   @"USER"
97 #define WCUsersCommand                                  @"USERS"
98 #define WCWhoCommand                                    @"WHO"
99
100 #define WCConnectionDidConnect                  @"WCConnectionDidConnect"
101 #define WCConnectionDidClose                    @"WCConnectionDidClose"
102 #define WCConnectionWillTerminate               @"WCConnectionWillTerminate"
103 #define WCConnectionShouldTerminate             @"WCConnectionShouldTerminate"
104 #define WCConnectionDidTerminate                @"WCConnectionDidTerminate"
105
106 #define WCConnectionReceivedMessage             @"WCConnectionReceivedMessage"
107 #define WCConnectionReceivedError               @"WCConnectionReceivedError"
108 #define WCConnectionSentCommand                 @"WCConnectionSentCommand"
109
110 #define WCArgumentsKey                                  @"WCArgumentsKey"
111 #define WCMessageKey                                    @"WCMessageKey"
112 #define WCErrorKey                                              @"WCErrorKey"
113
114
115 typedef uint32_t                                                WCProtocolInt32;
116 typedef uint64_t                                                WCProtocolInt64;
117
118 typedef WCProtocolInt32                                 WCProtocolMessage;                             
119 typedef WCProtocolInt32                                 WCUserID;
120 typedef WCProtocolInt32                                 WCChatID;
121
122
123 @protocol WCConnection <NSObject>
124
125 - (void)addObserver:(id)target selector:(SEL)action name:(NSString *)name;
126 - (void)removeObserver:(id)target;
127 - (void)removeObserver:(id)target name:(NSString *)name;
128 - (void)postNotificationName:(NSString *)name;
129 - (void)postNotificationName:(NSString *)name object:(id)object;
130 - (void)postNotificationName:(NSString *)name object:(id)object userInfo:(NSDictionary *)userInfo;
131
132 - (void)sendCommand:(NSString *)command;
133 - (void)sendCommand:(NSString *)command withArgument:(NSString *)argument1;
134 - (void)sendCommand:(NSString *)command withArgument:(NSString *)argument1 withArgument:(NSString *)argument2;
135 - (void)sendCommand:(NSString *)command withArgument:(NSString *)argument1 withArgument:(NSString *)argument2 withArgument:(NSString *)argument3;
136 - (void)sendCommand:(NSString *)command withArguments:(NSArray *)arguments;
137 - (void)ignoreError:(WCProtocolMessage)error;
138
139 - (void)connect;
140 - (void)disconnect;
141 - (void)terminate;
142
143 - (WIURL *)URL;
144 - (WISocket *)socket;
145 - (BOOL)isConnected;
146 - (double)protocol;
147
148 @end
Note: See TracBrowser for help on using the browser.