Starshatter_Open
Open source Starshatter engine
Main Page
Classes
Files
File List
File Members
All
Classes
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
NetMsg.h
Go to the documentation of this file.
1
/* Project nGenEx
2
Destroyer Studios LLC
3
Copyright © 1997-2004. All Rights Reserved.
4
5
SUBSYSTEM: NetEx.lib
6
FILE: NetMsg.h
7
AUTHOR: John DiCamillo
8
9
10
OVERVIEW
11
========
12
User level network message
13
*/
14
15
16
#ifndef NetMsg_h
17
#define NetMsg_h
18
19
#include <windows.h>
20
#include "
NetAddr.h
"
21
#include "
NetGram.h
"
22
#include "
NetSock.h
"
23
#include "
List.h
"
24
25
// +-------------------------------------------------------------------+
26
27
class
NetMsg
28
{
29
public
:
30
static
const
char
*
TYPENAME
() {
return
"NetMsg"
; }
31
32
enum
FLAGS
{
RELIABLE
= 0x01,
PRIORITY
= 0x02,
SCATTER
= 0x04 };
33
enum
TYPES
{
INVALID
= 0,
34
RESERVED
= 0xF0,
35
MULTIPART
= 0xF1
36
};
37
enum
{
MAX_SIZE
= 250 };
38
39
NetMsg
(DWORD nid,
void
* d,
int
l, BYTE f=0);
40
NetMsg
(DWORD nid, BYTE type,
const
char
* text,
int
len, BYTE f=0);
41
~NetMsg
();
42
43
int
operator ==
(
const
NetMsg
& m)
const
{
return
msgid == m.msgid &&
44
netid == m.netid; }
45
int
operator <
(
const
NetMsg
& m)
const
;
46
47
DWORD
Sequence
()
const
{
return
msgid; }
48
DWORD
NetID
()
const
{
return
netid; }
49
const
BYTE*
Data
()
const
{
return
data; }
50
BYTE
Type
()
const
{
return
data ? *data : 0; }
51
int
Length
()
const
{
return
len; }
52
BYTE
Flags
()
const
{
return
flags; }
53
54
bool
IsReliable
()
const
{
return
flags &
RELIABLE
?
true
:
false
; }
55
bool
IsPriority
()
const
{
return
flags &
PRIORITY
?
true
:
false
; }
56
bool
IsScatter
()
const
{
return
flags &
SCATTER
?
true
:
false
; }
57
58
void
SetSequence
(DWORD s) { msgid = s; }
59
60
private
:
61
DWORD msgid;
62
DWORD netid;
63
BYTE* data;
64
int
len;
65
BYTE flags;
66
};
67
68
// +-------------------------------------------------------------------+
69
70
struct
NetMsgMultipart
{
71
BYTE
type
;
72
BYTE
len
;
73
DWORD
msgid
;
74
DWORD
partno
;
75
DWORD
nparts
;
76
BYTE
payload
[256];
77
};
78
79
// +-------------------------------------------------------------------+
80
81
#endif NetMsg_h
NetEx
NetMsg.h
Generated on Tue Jun 5 2012 20:46:18 for Starshatter_Open by
1.8.1