Rigs of Rods 2023.09
Soft-body Physics Simulation
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Loading...
Searching...
No Matches
RoRnet.h
Go to the documentation of this file.
1/*
2 This file is part of Rigs of Rods
3
4 Copyright 2007 Pierre-Michel Ricordel
5 Copyright 2014+ Petr Ohlidal & contributors.
6
7 Rigs of Rods is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; version 3 of the License.
10
11 Rigs of Rods is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
18*/
19
20#pragma once
21
22#include "BitFlags.h"
23
27
28namespace RoRnet {
29
30#define RORNET_MAX_PEERS 64
31#define RORNET_MAX_MESSAGE_LENGTH 8192
32#define RORNET_LAN_BROADCAST_PORT 13000
33#define RORNET_MAX_USERNAME_LEN 40
34
35#define RORNET_VERSION "RoRnet_2.45"
36
74
84
102
127
128// Flags used only locally on client to filter and control incoming traffic.
135
136// Used by client to display informative icons on MP player list.
138{
139 INVALID = -1,
140 MISMATCHES = 0,
141 ALL_OK = 1,
142 IDLE = 2,
143};
144
145// -------------------------------- structs -----------------------------------
146// Only use datatypes with defined binary sizes (avoid bool, int, wchar_t...)
147// Prefer alignment to 4 or 2 bytes (put int32/float/etc. fields on top)
148
149#pragma pack(push, 1)
150
151struct Header
152{
153 uint32_t command;
154 int32_t source;
155 uint32_t streamid;
156 uint32_t size;
157};
158
160{
161 int32_t type;
162 int32_t status;
165 char name[128];
166 char data[128];
167};
168
170{
171 // RoRnet::StreamRegister: Common
172 int32_t type;
173 int32_t status;
176 char name[128];
177 // RoRnet::StreamRegister: Data buffer (128B)
178 int32_t bufferSize;
179 int32_t time;
180 char skin[60];
181 char sectionconfig[60];
182};
183
184struct StreamUnRegister //< sent to remove a stream
185{
186 uint32_t streamid;
187};
188
190{
191 uint32_t uniqueid;
192 int32_t authstatus;
193 int32_t slotnum;
194 int32_t colournum;
195
197 char usertoken[40];
198 char serverpassword[40];
199 char language[10];
200 char clientname[10];
201 char clientversion[25];
202 char clientGUID[40];
203 char sessiontype[10];
204 char sessionoptions[128];
205};
206
220
222{
224 char terrain[128];
225 char servername[128];
226 uint8_t has_password;
227 char info[4096];
228};
229
231{
233};
234
235} // namespace RoRnet
236
238
239#pragma pack(pop)
Bit operations.
#define BITMASK(OFFSET)
Definition BitFlags.h:10
uint32_t BitMask_t
Definition BitFlags.h:7
PeerOptions
Definition RoRnet.h:130
@ PEEROPT_HIDE_ACTORS
Spawn actors hidden and immediatelly hide existing actors.
Definition RoRnet.h:133
@ PEEROPT_MUTE_ACTORS
Spawn actors muted and immediatelly mute existing actors.
Definition RoRnet.h:132
@ PEEROPT_MUTE_CHAT
CHAT and PRIVCHAT messages will not be allowed through.
Definition RoRnet.h:131
UserAuth
Definition RoRnet.h:76
@ AUTH_MOD
moderator status
Definition RoRnet.h:80
@ AUTH_NONE
no authentication
Definition RoRnet.h:77
@ AUTH_BANNED
banned
Definition RoRnet.h:82
@ AUTH_BOT
bot status
Definition RoRnet.h:81
@ AUTH_RANKED
ranked status
Definition RoRnet.h:79
@ AUTH_ADMIN
admin on the server
Definition RoRnet.h:78
Lightmask
Definition RoRnet.h:104
@ LIGHTMASK_REVERSE
reverse light on
Definition RoRnet.h:121
@ LIGHTMASK_CUSTOM8
custom light 8 on
Definition RoRnet.h:112
@ LIGHTMASK_BEACONS
beacons on
Definition RoRnet.h:122
@ LIGHTMASK_CUSTOM7
custom light 7 on
Definition RoRnet.h:111
@ LIGHTMASK_CUSTOM3
custom light 3 on
Definition RoRnet.h:107
@ LIGHTMASK_CUSTOM4
custom light 4 on
Definition RoRnet.h:108
@ LIGHTMASK_CUSTOM1
custom light 1 on
Definition RoRnet.h:105
@ LIGHTMASK_BRAKES
brake lights on
Definition RoRnet.h:120
@ LIGHTMASK_CUSTOM2
custom light 2 on
Definition RoRnet.h:106
@ LIGHTMASK_CUSTOM6
custom light 6 on
Definition RoRnet.h:110
@ LIGHTMASK_BLINK_RIGHT
right blinker on
Definition RoRnet.h:124
@ LIGHTMASK_CUSTOM10
custom light 10 on
Definition RoRnet.h:114
@ LIGHTMASK_CUSTOM5
custom light 5 on
Definition RoRnet.h:109
@ LIGHTMASK_FOGLIGHTS
Definition RoRnet.h:118
@ LIGHTMASK_BLINK_WARN
warn blinker on
Definition RoRnet.h:125
@ LIGHTMASK_HEADLIGHT
Definition RoRnet.h:116
@ LIGHTMASK_CUSTOM9
custom light 9 on
Definition RoRnet.h:113
@ LIGHTMASK_HIGHBEAMS
Definition RoRnet.h:117
@ LIGHTMASK_SIDELIGHTS
Definition RoRnet.h:119
@ LIGHTMASK_BLINK_LEFT
left blinker on
Definition RoRnet.h:123
Netmask
Definition RoRnet.h:86
@ NETMASK_PBRAKE
parking brake
Definition RoRnet.h:90
@ NETMASK_POLICEAUDIO
police siren on
Definition RoRnet.h:88
@ NETMASK_PARTICLE
custom particles on
Definition RoRnet.h:89
@ NETMASK_ALB_ACTIVE
anti lock brake light on?
Definition RoRnet.h:92
@ NETMASK_ENGINE_CONT
ignition on?
Definition RoRnet.h:93
@ NETMASK_ENGINE_RUN
engine running?
Definition RoRnet.h:94
@ NETMASK_HORN
horn is in use
Definition RoRnet.h:87
@ NETMASK_ENGINE_MODE_AUTOMATIC
engine mode
Definition RoRnet.h:96
@ NETMASK_ENGINE_MODE_SEMIAUTO
engine mode
Definition RoRnet.h:97
@ NETMASK_ENGINE_MODE_MANUAL_STICK
engine mode
Definition RoRnet.h:99
@ NETMASK_TC_ACTIVE
traction control light on?
Definition RoRnet.h:91
@ NETMASK_ENGINE_MODE_MANUAL
engine mode
Definition RoRnet.h:98
@ NETMASK_ENGINE_MODE_MANUAL_RANGES
engine mode
Definition RoRnet.h:100
MessageType
Definition RoRnet.h:38
@ MSG2_STREAM_REGISTER_RESULT
result of a stream creation
Definition RoRnet.h:64
@ MSG2_STREAM_DATA_DISCARDABLE
stream data that is allowed to be discarded
Definition RoRnet.h:67
@ MSG2_MASTERINFO
master information response
Definition RoRnet.h:52
@ MSG2_NO_RANK
client has no ranked status
Definition RoRnet.h:69
@ MSG2_WRONG_VER_LEGACY
Wrong version.
Definition RoRnet.h:72
@ MSG2_WRONG_VER
wrong version
Definition RoRnet.h:44
@ MSG2_USER_LEAVE
user leaves
Definition RoRnet.h:58
@ MSG2_USER_INFO
user data that is sent from the server to the clients
Definition RoRnet.h:51
@ MSG2_WELCOME
we can proceed
Definition RoRnet.h:46
@ MSG2_STREAM_UNREGISTER
remove stream
Definition RoRnet.h:65
@ MSG2_SERVER_SETTINGS
server send client the terrain name: server_info_t
Definition RoRnet.h:50
@ MSG2_HELLO
client sends its version as first message
Definition RoRnet.h:39
@ MSG2_USER_JOIN
new user joined
Definition RoRnet.h:57
@ MSG2_UTF8_CHAT
broadcast chat line in UTF8 encoding; Payload: const char*(text)
Definition RoRnet.h:59
@ MSG2_FULL
no more slots for us
Definition RoRnet.h:42
@ MSG2_VERSION
server responds with its version
Definition RoRnet.h:49
@ MSG2_STREAM_DATA
stream data
Definition RoRnet.h:66
@ MSG2_GAME_CMD
Script message. Can be sent in both directions.
Definition RoRnet.h:56
@ MSG2_NETQUALITY
network quality information
Definition RoRnet.h:53
@ MSG2_UTF8_PRIVCHAT
private chat line in UTF8 encoding; Payload: uint32_t(uniqueid), const char*(text)
Definition RoRnet.h:60
@ MSG2_WRONG_PW
server send that on wrong pw
Definition RoRnet.h:43
@ MSG2_STREAM_REGISTER
create new stream
Definition RoRnet.h:63
@ MSG2_BANNED
client not allowed to join
Definition RoRnet.h:45
UiStreamsHealth
Definition RoRnet.h:138
@ ALL_OK
Stream is OK - no errors loading the mods.
@ MISMATCHES
Loading errors - some mods could not be loaded (probably not installed)
@ IDLE
Player has no active streams.
@ INVALID
Invalid status.
#define RORNET_MAX_USERNAME_LEN
bytes.
Definition RoRnet.h:33
< Must preserve mem. layout of RoRnet::StreamRegister
Definition RoRnet.h:170
int32_t bufferSize
initial stream status
Definition RoRnet.h:178
char sectionconfig[60]
section configuration
Definition RoRnet.h:181
int32_t status
initial stream status
Definition RoRnet.h:173
char name[128]
truck file name
Definition RoRnet.h:176
int32_t origin_sourceid
origin sourceid
Definition RoRnet.h:174
int32_t origin_streamid
origin streamid
Definition RoRnet.h:175
int32_t time
initial time stamp
Definition RoRnet.h:179
< Common header for every packet
Definition RoRnet.h:152
uint32_t streamid
streamid for this command
Definition RoRnet.h:155
uint32_t command
the command of this packet: MSG2_*
Definition RoRnet.h:153
uint32_t size
size of the attached data block
Definition RoRnet.h:156
int32_t source
source of this command: 0 = server
Definition RoRnet.h:154
char protocolversion[20]
protocol version being used
Definition RoRnet.h:232
char servername[128]
name of the server
Definition RoRnet.h:225
char info[4096]
info text
Definition RoRnet.h:227
uint8_t has_password
passworded server?
Definition RoRnet.h:226
char terrain[128]
terrain name
Definition RoRnet.h:224
char protocolversion[20]
protocol version being used
Definition RoRnet.h:223
< Sent from the client to server and vice versa, to broadcast a new stream
Definition RoRnet.h:160
int32_t type
0 = Actor, 1 = Character, 3 = ChatSystem
Definition RoRnet.h:161
char data[128]
data used for stream setup
Definition RoRnet.h:166
int32_t origin_streamid
origin streamid
Definition RoRnet.h:164
int32_t origin_sourceid
origin sourceid
Definition RoRnet.h:163
char name[128]
file name
Definition RoRnet.h:165
int32_t status
initial stream status
Definition RoRnet.h:162
int32_t authstatus
auth status set by server: AUTH_*
Definition RoRnet.h:192
char sessionoptions[128]
reserved for future options
Definition RoRnet.h:204
char clientname[10]
the name and version of the client. For exmaple: "ror" or "gamebot"
Definition RoRnet.h:200
char language[10]
user's language. For example "de-DE" or "en-US"
Definition RoRnet.h:199
char username[RORNET_MAX_USERNAME_LEN]
the nickname of the user (UTF-8)
Definition RoRnet.h:196
int32_t colournum
colour set by server
Definition RoRnet.h:194
char usertoken[40]
user token
Definition RoRnet.h:197
int32_t slotnum
slot number set by server
Definition RoRnet.h:193
char clientGUID[40]
the clients GUID
Definition RoRnet.h:202
char serverpassword[40]
server password
Definition RoRnet.h:198
char sessiontype[10]
the requested session type. For example "normal", "bot", "rcon"
Definition RoRnet.h:203
uint32_t uniqueid
user unique id
Definition RoRnet.h:191
char clientversion[25]
a version number of the client. For example 1 for RoR 0.35
Definition RoRnet.h:201
< Formerly oob_t
Definition RoRnet.h:208
float brake
the brake value
Definition RoRnet.h:215
float engine_speed
engine RPM
Definition RoRnet.h:210
BitMask_t flagmask
flagmask: NETMASK_*
Definition RoRnet.h:217
float wheelspeed
the wheel speed value
Definition RoRnet.h:216
BitMask_t lightmask
flagmask: LIGHTMASK_*
Definition RoRnet.h:218
int32_t time
time data
Definition RoRnet.h:209
float engine_clutch
the clutch value
Definition RoRnet.h:212
float hydrodirstate
the turning direction status
Definition RoRnet.h:214
int32_t engine_gear
engine gear
Definition RoRnet.h:213
float engine_force
engine acceleration
Definition RoRnet.h:211