zenilib: zenilib/jni/external/sdl_net/chat.h Source File

zenilib 0.5.3.0

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
chat.h
Go to the documentation of this file.
1 /*
2 CHAT: A chat client/server using the SDL example network library
3 Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
4
5 This software is provided 'as-is', without any express or implied
6 warranty. In no event will the authors be held liable for any damages
7 arising from the use of this software.
8
9 Permission is granted to anyone to use this software for any purpose,
10 including commercial applications, and to alter it and redistribute it
11 freely, subject to the following restrictions:
12
13 1. The origin of this software must not be misrepresented; you must not
14 claim that you wrote the original software. If you use this software
15 in a product, an acknowledgment in the product documentation would be
16 appreciated but is not required.
17 2. Altered source versions must be plainly marked as such, and must not be
18 misrepresented as being the original software.
19 3. This notice may not be removed or altered from any source distribution.
20 */
21
22 /* $Id$ */
23
24 /* Convert four letters into a number */
25 #define MAKE_NUM(A, B, C, D) (((A+B)<<8)|(C+D))
26
27 /* Defines for the chat client */
28 #define CHAT_SCROLLBACK 512 /* Save 512 lines in scrollback */
29 #define CHAT_PROMPT "> "
30 #define CHAT_PACKETSIZE 256 /* Maximum length of a message */
31
32 /* Defines shared between the server and client */
33 #define CHAT_PORT MAKE_NUM('C','H','A','T')
34
35 /* The protocol between the chat client and server */
36 #define CHAT_HELLO 0 /* 0+Port+len+name */
37 #define CHAT_HELLO_PORT 1
38 #define CHAT_HELLO_NLEN CHAT_HELLO_PORT+2
39 #define CHAT_HELLO_NAME CHAT_HELLO_NLEN+1
40 #define CHAT_ADD 1 /* 1+N+IP+Port+len+name */
41 #define CHAT_ADD_SLOT 1
42 #define CHAT_ADD_HOST CHAT_ADD_SLOT+1
43 #define CHAT_ADD_PORT CHAT_ADD_HOST+4
44 #define CHAT_ADD_NLEN CHAT_ADD_PORT+2
45 #define CHAT_ADD_NAME CHAT_ADD_NLEN+1
46 #define CHAT_DEL 2 /* 2+N */
47 #define CHAT_DEL_SLOT 1
48 #define CHAT_DEL_LEN CHAT_DEL_SLOT+1
49 #define CHAT_BYE 255 /* 255 */
50 #define CHAT_BYE_LEN 1
51
52 /* The maximum number of people who can talk at once */
53 #define CHAT_MAXPEOPLE 10