正在显示
1 个修改的文件
包含
71 行增加
和
0 行删除
src/server/spserver/sprequest.cpp
0 → 100644
1 | +/* | ||
2 | + * Copyright 2007 Stephen Liu | ||
3 | + * For license terms, see the file COPYING along with this library. | ||
4 | + */ | ||
5 | + | ||
6 | +#include <string.h> | ||
7 | +#include <stdio.h> | ||
8 | + | ||
9 | +#include "spporting.hpp" | ||
10 | + | ||
11 | +#include "sprequest.hpp" | ||
12 | +#include "spmsgdecoder.hpp" | ||
13 | +#include "sputils.hpp" | ||
14 | + | ||
15 | +SP_Request :: SP_Request() | ||
16 | +{ | ||
17 | + mDecoder = new SP_DefaultMsgDecoder(); | ||
18 | + | ||
19 | + memset( mClientIP, 0, sizeof( mClientIP ) ); | ||
20 | + mClientPort = 0; | ||
21 | + | ||
22 | + memset( mServerIP, 0, sizeof( mServerIP ) ); | ||
23 | +} | ||
24 | + | ||
25 | +SP_Request :: ~SP_Request() | ||
26 | +{ | ||
27 | + if( NULL != mDecoder ) delete mDecoder; | ||
28 | + mDecoder = NULL; | ||
29 | +} | ||
30 | + | ||
31 | +SP_MsgDecoder * SP_Request :: getMsgDecoder() | ||
32 | +{ | ||
33 | + return mDecoder; | ||
34 | +} | ||
35 | + | ||
36 | +void SP_Request :: setMsgDecoder( SP_MsgDecoder * decoder ) | ||
37 | +{ | ||
38 | + if( NULL != mDecoder ) delete mDecoder; | ||
39 | + mDecoder = decoder; | ||
40 | +} | ||
41 | + | ||
42 | +void SP_Request :: setClientIP( const char * clientIP ) | ||
43 | +{ | ||
44 | + sp_strlcpy( mClientIP, clientIP, sizeof( mClientIP ) ); | ||
45 | +} | ||
46 | + | ||
47 | +const char * SP_Request :: getClientIP() | ||
48 | +{ | ||
49 | + return mClientIP; | ||
50 | +} | ||
51 | + | ||
52 | +void SP_Request :: setClientPort( int port ) | ||
53 | +{ | ||
54 | + mClientPort = port; | ||
55 | +} | ||
56 | + | ||
57 | +int SP_Request :: getClientPort() | ||
58 | +{ | ||
59 | + return mClientPort; | ||
60 | +} | ||
61 | + | ||
62 | +void SP_Request :: setServerIP( const char * ip ) | ||
63 | +{ | ||
64 | + sp_strlcpy( mServerIP, ip, sizeof( mServerIP ) ); | ||
65 | +} | ||
66 | + | ||
67 | +const char * SP_Request :: getServerIP() | ||
68 | +{ | ||
69 | + return mServerIP; | ||
70 | +} | ||
71 | + |
请
注册
或
登录
后发表评论