forked from haithun/CoD4X17a_testing
-
Notifications
You must be signed in to change notification settings - Fork 0
/
hl2rcon.h
119 lines (97 loc) · 3.83 KB
/
hl2rcon.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
/*
===========================================================================
Copyright (C) 2010-2013 Ninja and TheKelm of the IceOps-Team
This file is part of CoD4X17a-Server source code.
CoD4X17a-Server source code is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
CoD4X17a-Server source code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>
===========================================================================
*/
#include "q_shared.h"
#include "sys_net.h"
#include "msg.h"
#ifndef __HL2RCON_H__
#define __HL2RCON_H__
/*
========================================================================
Source Rcon facility
========================================================================
*/
#define MAX_RCONUSERS 8
#define MAX_RCONLOGINS 64
typedef struct{
netadr_t remote;
int socketfd;
int lastpacketid;
qboolean streamlog;
qboolean streamchat;
qboolean streamgamelog;
qboolean streamevents;
int rconPower; //unused for now
char rconUsername[32];
}rconUser_t;
typedef struct{
char username[32];
char salt[129];
char sha256[65];
int power;
}rconLogin_t;
typedef struct{
rconLogin_t rconUsers[MAX_RCONLOGINS];
rconUser_t activeRconUsers[MAX_RCONUSERS];
//For redirect
int redirectUser;
}sourceRcon_t;
typedef enum{
SERVERDATA_RESPONSE_VALUE = 0,
SERVERDATA_EXECCOMMAND = 2,
SERVERDATA_AUTH_RESPONSE = 2,
SERVERDATA_AUTH = 3,
SERVERDATA_CHANGEPASSWORD = 63,
SERVERDATA_TURNONSTREAM = 64,
SERVERDATA_GAMELOG = 65,
SERVERDATA_CONLOG = 66,
SERVERDATA_CHAT = 67,
SERVERDATA_GETSTATUS = 68,
SERVERDATA_STATUSRESPONSE = 69,
SERVERDATA_SAY = 70,
SERVERDATA_EVENT = 71
}sourceRconCommands_t;
typedef enum{
RCONEVENT_PLAYERENTERGAME = 0,
RCONEVENT_PLAYERLEAVE = 1,
RCONEVENT_LEVELSTART = 2,
RCONEVENT_PLAYERENTERTEAM = 3
}sourceRconEvents_t;
void HL2Rcon_SetSourceRconAdmin_f( void );
void HL2Rcon_UnsetSourceRconAdmin_f( void );
void HL2Rcon_ListSourceRconAdmins_f( void );
void HL2Rcon_ChangeSourceRconAdminPassword( const char* password );
void HL2Rcon_SourceRconStreaming_enable( int type );
qboolean HL2Rcon_AddSourceRconAdminToList(const char* username, const char* password, const char* salt, int power);
void HL2Rcon_ClearSourceRconAdminList( void );
void HL2Rcon_SourceRconDisconnect(netadr_t *from, int socketfd, int connectionId);
tcpclientstate_t HL2Rcon_SourceRconAuth(netadr_t *from, msg_t *msg, int socketfd, int *connectionId);
void HL2Rcon_SourceRconSendConsole( const char* data, int msglen);
void HL2Rcon_SourceRconSendChat( const char* data, int clientnum, int type);
void HL2Rcon_SourceRconSendDataToEachClient( const byte* data, int msglen, int type);
void HL2Rcon_SourceRconFlushRedirect(char* outputbuf, qboolean lastcommand);
qboolean HL2Rcon_SourceRconEvent(netadr_t *from, msg_t *msg, int socketfd, int connectionId);
void HL2Rcon_AddSourceAdminCommands();
void HL2Rcon_SourceRconSendGameLog( const char* data, int msglen);
void HL2Rcon_SourceRconSendChatToEachClient( const char *text, rconUser_t *self, int cid, qboolean onlyme);
void HL2Rcon_EventClientEnterTeam(int cid, int team);
void HL2Rcon_EventClientEnterWorld(int cid);
void HL2Rcon_EventClientLeave(int cid);
void HL2Rcon_EventLevelStart();
void HL2Rcon_Init();
qboolean HL2Rcon_InfoAddAdmin(const char* line);
void HL2Rcon_WriteAdminConfig(char* buffer, int size);
#endif