PIP 5.6.1
Platform-Independent Primitives
Public Types | Public Member Functions | List of all members
PICloud::TCP Class Reference

Builds and parses PICloud frames on top of PIStreamPacker. More...

#include <picloudtcp.h>

Public Types

enum  Version
 Supported PICloud frame versions.
 
enum  Role
 Logical destination role of a PICloud frame.
 
enum  Type
 Kind of PICloud frame payload.
 

Public Member Functions

 TCP (PIStreamPacker *s)
 Constructs a PICloud frame helper bound to packer "s".
 
void setRole (Role r)
 Sets the logical role written into outgoing frames.
 
Role role () const
 Returns the logical role of this helper.
 
void setServerName (const PIString &server_name_)
 Sets the logical server name used by connect and keepalive frames.
 
PIString serverName () const
 Returns the configured logical server name.
 
void sendStart ()
 Sends the initial connect frame for the current server name.
 
void sendConnected (uint client_id)
 Sends a connect frame for logical client "client_id".
 
void sendDisconnected (uint client_id)
 Sends a disconnect frame for logical client "client_id".
 
int sendData (const PIByteArray &data)
 Sends a payload frame for the current logical role.
 
int sendData (const PIByteArray &data, uint client_id)
 Sends a payload frame tagged with logical client "client_id".
 
void sendPing ()
 Sends a keepalive frame.
 
PIPair< PICloud::TCP::Type, PICloud::TCP::RoleparseHeader (PIByteArray &ba)
 Parses frame header and returns its type and destination role.
 
bool canParseData (PIByteArray &ba)
 Returns whether current role uses direct payload parsing.
 
PIPair< uint, PIByteArrayparseDataServer (PIByteArray &ba)
 Extracts logical client identifier and payload from a server-side data frame.
 
PIByteArray parseConnect_d (PIByteArray &ba)
 Validates and returns raw connect payload used for server identity exchange.
 
uint parseConnect (PIByteArray &ba)
 Extracts logical client identifier from a connect frame.
 
uint parseDisconnect (PIByteArray &ba)
 Extracts logical client identifier from a disconnect frame.
 

Detailed Description

Builds and parses PICloud frames on top of PIStreamPacker.