netpack.h File Reference

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define NUMVERTEXNORMALS   162

Functions

void NET_WriteChar (struct dbuffer *buf, char c)
void NET_WriteByte (struct dbuffer *buf, byte c)
void NET_WriteShort (struct dbuffer *buf, int c)
void NET_WriteLong (struct dbuffer *buf, int c)
void NET_WriteString (struct dbuffer *buf, const char *str)
void NET_WriteRawString (struct dbuffer *buf, const char *str)
void NET_WriteCoord (struct dbuffer *buf, float f)
void NET_WritePos (struct dbuffer *buf, const vec3_t pos)
void NET_Write2Pos (struct dbuffer *buf, vec2_t pos)
void NET_WriteGPos (struct dbuffer *buf, const pos3_t pos)
void NET_WriteAngle (struct dbuffer *buf, float f)
void NET_WriteAngle16 (struct dbuffer *buf, float f)
void NET_WriteDir (struct dbuffer *buf, const vec3_t vector)
void NET_vWriteFormat (struct dbuffer *buf, const char *format, va_list ap)
 Writes to buffer according to format; version without syntactic sugar for variable arguments, to call it from other functions with variable arguments.
void NET_WriteFormat (struct dbuffer *buf, const char *format,...)
 The user-friendly version of NET_WriteFormat that writes variable arguments to buffer according to format.
void NET_VPrintf (struct dbuffer *buf, const char *format, va_list ap, char *str, size_t length)
void NET_WriteMsg (struct net_stream *s, struct dbuffer *buf)
 Enqueue the buffer in the net stream for ONE client.
void NET_WriteConstMsg (struct net_stream *s, const struct dbuffer *buf)
 Enqueue the buffer in the net stream for MULTIPLE clients.
void NET_OOB_Printf (struct net_stream *s, const char *format,...) __attribute__((format(printf
void int NET_ReadChar (struct dbuffer *buf)
int NET_ReadByte (struct dbuffer *buf)
 Reads a byte from the netchannel.
int NET_ReadShort (struct dbuffer *buf)
int NET_PeekShort (const struct dbuffer *buf)
 Peeks into a buffer without changing it to get a short int.
int NET_ReadLong (struct dbuffer *buf)
int NET_ReadString (struct dbuffer *buf, char *string, size_t length)
int NET_ReadStringLine (struct dbuffer *buf, char *string, size_t length)
float NET_ReadCoord (struct dbuffer *buf)
void NET_ReadPos (struct dbuffer *buf, vec3_t pos)
void NET_Read2Pos (struct dbuffer *buf, vec2_t pos)
void NET_ReadGPos (struct dbuffer *buf, pos3_t pos)
float NET_ReadAngle (struct dbuffer *buf)
float NET_ReadAngle16 (struct dbuffer *buf)
void NET_ReadDir (struct dbuffer *buf, vec3_t vector)
void NET_ReadData (struct dbuffer *buf, void *buffer, int size)
void NET_vReadFormat (struct dbuffer *buf, const char *format, va_list ap)
 Reads from a buffer according to format; version without syntactic sugar for variable arguments, to call it from other functions with variable arguments.
void NET_ReadFormat (struct dbuffer *buf, const char *format,...)
 The user-friendly version of NET_ReadFormat that reads variable arguments from a buffer according to format.
struct dbufferNET_ReadMsg (struct net_stream *s)
 Reads messages from the network channel and adds them to the dbuffer where you can use the NET_Read* functions to get the values in the correct order.

Variables

const vec3_t bytedirs [NUMVERTEXNORMALS]

Detailed Description

Definition in file netpack.h.


Define Documentation

#define NUMVERTEXNORMALS   162

Definition at line 31 of file netpack.h.


Function Documentation

void NET_OOB_Printf ( struct net_stream s,
const char *  format,
  ... 
)
int NET_PeekShort ( const struct dbuffer buf  ) 

Peeks into a buffer without changing it to get a short int.

Parameters:
buf The buffer, returned unchanged, no need to be copied before.
Returns:
The short at the beginning of the buffer, -1 if it couldn't be read.

Definition at line 262 of file netpack.c.

References dbuffer_get(), and LittleShort().

Referenced by CL_CheckDefault().

void NET_Read2Pos ( struct dbuffer buf,
vec2_t  pos 
)
See also:
NET_Write2Pos

Definition at line 347 of file netpack.c.

References NET_ReadLong().

float NET_ReadAngle ( struct dbuffer buf  ) 

Definition at line 375 of file netpack.c.

References NET_ReadChar().

Referenced by NET_vReadFormat(), and SV_ReadAngle().

float NET_ReadAngle16 ( struct dbuffer buf  ) 

Definition at line 380 of file netpack.c.

References NET_ReadShort(), and SHORT2ANGLE.

int NET_ReadByte ( struct dbuffer buf  ) 

Reads a byte from the netchannel.

Note:
Beware that you don't put this into a byte or short - this will overflow use an int value to store the return value when you read this via the net format strings!!!

Definition at line 239 of file netpack.c.

References dbuffer_extract().

Referenced by CL_ActorDoMove(), CL_DoEndRound(), CL_EndRoundAnnounce(), CL_GetEventTime(), CL_ParseEvent(), CL_ParseResults(), CL_ParseServerMessage(), CL_PingServerCallback(), CL_RconCallback(), CL_ReadPackets(), CL_ServerInfoCallback(), CL_StartGame(), CP_ParseCharacterData(), NET_ReadData(), NET_ReadDir(), NET_ReadGPos(), NET_ReadString(), NET_ReadStringLine(), NET_vReadFormat(), SV_ReadByte(), and SV_ReadPacket().

void int NET_ReadChar ( struct dbuffer buf  ) 

returns -1 if no more characters are available

Definition at line 225 of file netpack.c.

References dbuffer_extract().

Referenced by NET_ReadAngle(), NET_vReadFormat(), and SV_ReadChar().

float NET_ReadCoord ( struct dbuffer buf  ) 

Definition at line 339 of file netpack.c.

References NET_ReadLong().

void NET_ReadData ( struct dbuffer buf,
void *  buffer,
int  size 
)

Definition at line 388 of file netpack.c.

References byte, i, and NET_ReadByte().

Referenced by SV_ReadData().

void NET_ReadDir ( struct dbuffer buf,
vec3_t  vector 
)

Definition at line 396 of file netpack.c.

References bytedirs, Com_Error(), ERR_DROP, lengthof, NET_ReadByte(), and VectorCopy.

Referenced by NET_vReadFormat(), and SV_ReadDir().

void NET_ReadFormat ( struct dbuffer buf,
const char *  format,
  ... 
)
void NET_ReadGPos ( struct dbuffer buf,
pos3_t  pos 
)
See also:
NET_WriteGPos
NET_ReadByte
Note:
pos3_t are byte values

Definition at line 368 of file netpack.c.

References NET_ReadByte().

Referenced by NET_vReadFormat(), and SV_ReadGPos().

int NET_ReadLong ( struct dbuffer buf  ) 
struct dbuffer* NET_ReadMsg ( struct net_stream s  )  [read]

Reads messages from the network channel and adds them to the dbuffer where you can use the NET_Read* functions to get the values in the correct order.

See also:
NET_StreamDequeue
dbuffer_add

Definition at line 556 of file netpack.c.

References dbuffer_add(), len, LittleLong(), NET_StreamDequeue(), NET_StreamGetLength(), NET_StreamPeek(), and new_dbuffer().

Referenced by CL_PingServerCallback(), CL_RconCallback(), CL_ReadPackets(), CL_ServerInfoCallback(), and SV_ReadPacket().

void NET_ReadPos ( struct dbuffer buf,
vec3_t  pos 
)
See also:
NET_WritePos

Definition at line 356 of file netpack.c.

References NET_ReadLong().

Referenced by CL_ParseStartSoundPacket(), NET_vReadFormat(), and SV_ReadPos().

int NET_ReadShort ( struct dbuffer buf  ) 
int NET_ReadString ( struct dbuffer buf,
char *  string,
size_t  length 
)
Note:
Don't use this function in a way like char *s = NET_ReadString(sb); char *t = NET_ReadString(sb); The second reading uses the same data buffer for the string - so s is no longer the first - but the second string
strip high bits - don't use this for utf-8 strings
See also:
NET_ReadStringLine
Parameters:
[in,out] buf The input buffer to read the string data from
[out] string The output buffer to read the string into
[in] length The size of the output buffer

Definition at line 292 of file netpack.c.

References NET_ReadByte().

Referenced by CL_ConnectionlessPacket(), CL_ParseServerData(), CL_ParseServerInfoMessage(), CL_ParseServerMessage(), CL_ParseStartSoundPacket(), CL_ParseTeamInfoMessage(), CL_PingServerCallback(), CL_RconCallback(), CL_SetConfigString(), NET_vReadFormat(), SV_ExecuteClientMessage(), and SV_ReadString().

int NET_ReadStringLine ( struct dbuffer buf,
char *  string,
size_t  length 
)
void NET_VPrintf ( struct dbuffer buf,
const char *  format,
va_list  ap,
char *  str,
size_t  length 
)

Definition at line 581 of file netpack.c.

References dbuffer_add(), len, and Q_vsnprintf().

Referenced by SV_BroadcastPrintf(), SV_ClientCommand(), and SV_ClientPrintf().

void NET_vReadFormat ( struct dbuffer buf,
const char *  format,
va_list  ap 
)

Reads from a buffer according to format; version without syntactic sugar for variable arguments, to call it from other functions with variable arguments.

See also:
SV_ReadFormat
Parameters:
[in] buf The buffer we read the data from
[in] format The format string may not be NULL

Definition at line 411 of file netpack.c.

References byte, Com_Error(), ERR_DROP, i, NET_ReadAngle(), NET_ReadByte(), NET_ReadChar(), NET_ReadDir(), NET_ReadGPos(), NET_ReadLong(), NET_ReadPos(), NET_ReadShort(), and NET_ReadString().

Referenced by NET_ReadFormat(), and SV_ReadFormat().

void NET_vWriteFormat ( struct dbuffer buf,
const char *  format,
va_list  ap 
)

Writes to buffer according to format; version without syntactic sugar for variable arguments, to call it from other functions with variable arguments.

Definition at line 141 of file netpack.c.

References byte, Com_Error(), ERR_DROP, i, NET_WriteAngle(), NET_WriteByte(), NET_WriteChar(), NET_WriteDir(), NET_WriteGPos(), NET_WriteLong(), NET_WritePos(), NET_WriteShort(), and NET_WriteString().

Referenced by MSG_Write_PA(), NET_WriteFormat(), and SV_WriteFormat().

void NET_Write2Pos ( struct dbuffer buf,
vec2_t  pos 
)
See also:
NET_Read2Pos

Definition at line 75 of file netpack.c.

References NET_WriteLong().

void NET_WriteAngle ( struct dbuffer buf,
float  f 
)

Definition at line 98 of file netpack.c.

References NET_WriteByte().

Referenced by NET_vWriteFormat(), and SV_WriteAngle().

void NET_WriteAngle16 ( struct dbuffer buf,
float  f 
)

Definition at line 103 of file netpack.c.

References ANGLE2SHORT, and NET_WriteShort().

void NET_WriteByte ( struct dbuffer buf,
byte  c 
)
void NET_WriteChar ( struct dbuffer buf,
char  c 
)

Definition at line 31 of file netpack.c.

References dbuffer_add().

Referenced by NET_vWriteFormat(), and SV_WriteChar().

void NET_WriteConstMsg ( struct net_stream s,
const struct dbuffer buf 
)

Enqueue the buffer in the net stream for MULTIPLE clients.

Note:
Same as NET_WriteMsg but doesn't free the buffer, use this if you send the same buffer to more than one connected clients
Make sure that you free the msg buffer after you called this
See also:
NET_WriteMsg

Definition at line 534 of file netpack.c.

References dbuffer_get_at(), dbuffer_len, len, LittleLong(), NET_StreamEnqueue(), and pos.

Referenced by SV_BroadcastPrintf(), SV_FinalMessage(), and SV_Multicast().

void NET_WriteCoord ( struct dbuffer buf,
float  f 
)

Definition at line 67 of file netpack.c.

References NET_WriteLong().

void NET_WriteDir ( struct dbuffer buf,
const vec3_t  dir 
)
Note:
EV_ACTOR_SHOOT is using WriteDir for writing the normal, but ReadByte for reading it - keep that in mind when you change something here

Definition at line 112 of file netpack.c.

References bytedirs, DotProduct, i, lengthof, and NET_WriteByte().

Referenced by NET_vWriteFormat(), and SV_WriteDir().

void NET_WriteFormat ( struct dbuffer buf,
const char *  format,
  ... 
)

The user-friendly version of NET_WriteFormat that writes variable arguments to buffer according to format.

Definition at line 211 of file netpack.c.

References NET_vWriteFormat().

Referenced by CL_NetSendItem(), and MSG_Write_PA().

void NET_WriteGPos ( struct dbuffer buf,
const pos3_t  pos 
)

Definition at line 91 of file netpack.c.

References NET_WriteByte().

Referenced by NET_vWriteFormat(), and SV_WriteGPos().

void NET_WriteLong ( struct dbuffer buf,
int  c 
)
void NET_WriteMsg ( struct net_stream s,
struct dbuffer buf 
)
void NET_WritePos ( struct dbuffer buf,
const vec3_t  pos 
)
See also:
NET_ReadPos

Definition at line 84 of file netpack.c.

References NET_WriteLong().

Referenced by NET_vWriteFormat(), SV_StartSound(), and SV_WritePos().

void NET_WriteRawString ( struct dbuffer buf,
const char *  str 
)

Definition at line 61 of file netpack.c.

References dbuffer_add().

Referenced by SVC_Status(), and SVC_TeamInfo().

void NET_WriteShort ( struct dbuffer buf,
int  c 
)
void NET_WriteString ( struct dbuffer buf,
const char *  str 
)

Variable Documentation

const vec3_t bytedirs[NUMVERTEXNORMALS]

Generated by  doxygen 1.6.2