CTR Pia  4.11.3
Game Communication Engine
nn::pia::common Namespace Reference

Represents the PiaCommon namespace. More...

Classes

class  ByteOrder
 Converts the byte order. More...
 
class  CachedPrint
 Caches console output. This class is used for debugging. Do not use it in production versions of code.
. More...
 
class  CallContext
 Represents the calling context. More...
 
struct  CryptoSetting
 A structure for encryption settings. More...
 
class  DateTime
 Class that represents time. More...
 
class  ErrorHandler
 This class is used for error handling. More...
 
class  Event
 This class represents events. More...
 
struct  ExecuteResult
 Represents the result of calling the Execute function. More...
 
struct  InAddr
 An IPv4 address structure. More...
 
class  InetAddress
 Class that represents an Internet address. More...
 
class  Log
 This class is used for logging. More...
 
class  MemoryLeakChecker
 This class is used to automatically detect memory leaks inside the Pia library. More...
 
class  RootObject
 This is the common base class used inside the Pia library. More...
 
class  Scheduler
 Represents a job scheduler. More...
 
class  SignatureSetting
 This class maintains signature setting information. More...
 
class  SignatureSettingWithKeyBuffer
 This class represents signature setting information and includes an internal signature key buffer. More...
 
class  StationAddress
 Represents an address used to uniquely identify stations.
. More...
 
class  String
 Class for representing strings. More...
 
class  Time
 Class that represents time. More...
 
class  TimeSpan
 Class for representing time spans. This class can perform type conversions with numeric values in milliseconds. More...
 
class  Trace
 This class is the trace class. More...
 
class  Watermark
 Contains member functions for profiling things like peak values in the Pia library's resource usage (unsupported). More...
 
class  WatermarkManager
 This class manages a collection of Watermark instances (not supported). More...
 

Typedefs

typedef void(* InternalPrintCallback) (const char *pStr, s32 len)
 The callback type passed to RegisterInternalPrintCallback. More...
 
typedef s32 TimeInterval
 Type that represents a time interval. The value is in milliseconds.
 
typedef u64 TraceFlag
 Defines the tracing flag type. More...
 

Enumerations

Functions

nn::Result BeginSetup (void)
 Declares the start of setup. More...
 
nn::Result EndSetup (void)
 Declares the end of setup. More...
 
void Finalize (void)
 Finalizes the common module. More...
 
size_t GetMemoryUsage (void)
 Gets the amount of memory being used by the Pia library at the point this function is called. More...
 
nn::Result Initialize (void *pMem, u32 size)
 Initializes the common module. More...
 
bool IsInitialized (void)
 Indicates whether the common module is initialized. More...
 
InternalPrintCallback RegisterInternalPrintCallback (InternalPrintCallback pCallback)
 Sets the callback that hooks the Pia console output. More...
 

Variables

TraceFlag

static const TraceFlag TRACE_FLAG_NEVER = 0LL
 The flag indicating that this is never displayed.
 
static const TraceFlag TRACE_FLAG_ALWAYS = 1LL << 0
 The flag indicating that this is always displayed.
 
static const TraceFlag TRACE_FLAG_COMMON = 1LL << 1
 Flag for tracing the PiaCommon module.
 
static const TraceFlag TRACE_FLAG_COMMON_EVENT = 1LL << 2
 Flag for tracing events in the PiaCommon module.
 
static const TraceFlag TRACE_FLAG_COMMON_JOB = 1LL << 3
 Flag for tracing jobs in the PiaCommon module.
 
static const TraceFlag TRACE_FLAG_LOCAL = 1LL << 5
 Flag for tracing the PiaLocal module.
 
static const TraceFlag TRACE_FLAG_LOCAL_TRANSPORT = 1LL << 6
 Flag for tracing sending and receiving in the PiaLocal module.
 
static const TraceFlag TRACE_FLAG_LOCAL_MIGRATION = 1LL << 7
 Flag for tracing host migration in the PiaLocal module.
 
static const TraceFlag TRACE_FLAG_INET = 1LL << 9
 Flag for tracing the PiaInet module.
 
static const TraceFlag TRACE_FLAG_INET_INIT = 1LL << 10
 Flag for tracing initialization and finalization in the PiaInet module.
 
static const TraceFlag TRACE_FLAG_INET_SOCKET = 1LL << 11
 Flag for tracing sockets in the PiaInet module.
 
static const TraceFlag TRACE_FLAG_INET_SOCKET_DETAIL = 1LL << 12
 Flag for verbose tracing of sockets in the PiaInet module.
 
static const TraceFlag TRACE_FLAG_INET_SOCKET_SEND = 1LL << 13
 Flag for tracing send operations in the PiaInet module.
 
static const TraceFlag TRACE_FLAG_INET_SOCKET_RECEIVE = 1LL << 14
 Flag for tracing receive operations in the PiaInet module.
 
static const TraceFlag TRACE_FLAG_INET_NAT = 1LL << 15
 Flag for tracing NAT traversal by the PiaInet module.
 
static const TraceFlag TRACE_FLAG_INET_NAT_DETAIL = 1LL << 16
 Flag for verbose tracing of NAT traversal by the PiaInet module.
 
static const TraceFlag TRACE_FLAG_INET_NAT_PROBE = 1LL << 17
 Flag for verbose tracing of NAT traversal by the PiaInet module.
 
static const TraceFlag TRACE_FLAG_INET_GATEWAY = 1LL << 18
 Flag for tracing gateway services in the PiaInet module. (There are no plans to put gateway services into production.)
 
static const TraceFlag TRACE_FLAG_TRANSPORT = 1LL << 19
 Flag for tracing the PiaTransport module.
 
static const TraceFlag TRACE_FLAG_TRANSPORT_INIT = 1LL << 20
 Flag for tracing initialization and finalization in the PiaTransport module.
 
static const TraceFlag TRACE_FLAG_TRANSPORT_KEEP_ALIVE = 1LL << 21
 Flag for tracing keep-alives in the PiaTransport module.
 
static const TraceFlag TRACE_FLAG_TRANSPORT_RTT = 1LL << 22
 Flag for tracing the round-trip time (RTT) protocol in the PiaTransport module.
 
static const TraceFlag TRACE_FLAG_TRANSPORT_BUFFER = 1LL << 23
 Flag for tracing buffers in the PiaTransport module.
 
static const TraceFlag TRACE_FLAG_TRANSPORT_PACKET_SEND = 1LL << 24
 Flag for tracing packet sending in the PiaTransport module.
 
static const TraceFlag TRACE_FLAG_TRANSPORT_PACKET_RECEIVE = 1LL << 25
 Flag for tracing packet reception in the PiaTransport module.
 
static const TraceFlag TRACE_FLAG_TRANSPORT_PROTOCOLMESSAGE_SEND = 1LL << 26
 Flag for tracing ProtocolMessage sending in the PiaTransport module.
 
static const TraceFlag TRACE_FLAG_TRANSPORT_PROTOCOLMESSAGE_RECEIVE = 1LL << 27
 Flag for tracing ProtocolMessage reception in the PiaTransport module.
 
static const TraceFlag TRACE_FLAG_TRANSPORT_RELAY = 1LL << 28
 Flag for tracing the relay feature of the PiaTransport module.
 
static const TraceFlag TRACE_FLAG_TRANSPORT_RELAY_DETAIL = 1LL << 29
 Flag for tracing the details of the relay feature in the PiaTransport module.
 
static const TraceFlag TRACE_FLAG_SESSION = 1LL << 30
 Flag for tracing the PiaSession module.
 
static const TraceFlag TRACE_FLAG_SESSION_CONNECT = 1LL << 31
 Flag for tracing connections in the PiaSession module.
 
static const TraceFlag TRACE_FLAG_SESSION_LEAVE = 1LL << 32
 Flag for tracing disconnections in the PiaSession module.
 
static const TraceFlag TRACE_FLAG_SESSION_UPDATE = 1LL << 33
 Flag for tracing updates in the PiaSession module.
 
static const TraceFlag TRACE_FLAG_SESSION_MIGRATION = 1LL << 34
 Flag for tracing host migration in the PiaSession module.
 
static const TraceFlag TRACE_FLAG_SESSION_INIT = 1LL << 36
 Flag for tracing initialization and finalization in the PiaSession module.
 
static const TraceFlag TRACE_FLAG_SESSION_JOINT = 1LL << 37
 Flag for tracing joint sessions in the PiaSession module.
 
static const TraceFlag TRACE_FLAG_SYNC = 1LL << 39
 Flag for tracing the PiaSync module.
 
static const TraceFlag TRACE_FLAG_CLONE = 1LL << 41
 Flag for tracing the PiaClone module.
 
static const TraceFlag TRACE_FLAG_RECKONING = 1LL << 43
 Flag for tracing the PiaReckoning module.
 
static const TraceFlag TRACE_FLAG_CHAT = 1LL << 45
 Flag for tracing the PiaChat module.
 
static const TraceFlag TRACE_FLAG_UTIL = 1LL << 47
 Flag for tracing the PiaUtil module.
 
static const TraceFlag TRACE_FLAG_SERVICE = 1LL << 49
 Flag for tracing the PiaService module.
 
static const TraceFlag TRACE_FLAG_SERVICE_TRANSPORT = 1LL << 50
 Flag for tracing the PiaService module.
 
static const TraceFlag TRACE_FLAG_SERVICE_TRANSPORT_DETAIL = 1LL << 51
 Flag for tracing the PiaService module.
 
static const TraceFlag TRACE_FLAG_SERVICE_RELAY_SERVER = 1LL << 52
 Flag for tracing the PiaService module.
 
static const TraceFlag TRACE_FLAG_BRAIN = 1LL << 54
 Flag for tracing the PiaBrain module.
 
static const TraceFlag TRACE_FLAG_BRAIN_DETAIL = 1LL << 55
 Flag for tracing the PiaBrain module.
 
static const TraceFlag TRACE_FLAG_ALL = TRACE_FLAG_ALWAYS
 Flag for tracing everything.
 
static const TraceFlag TRACE_FLAG_DEFAULT = TRACE_FLAG_ALWAYS
 The default value for TraceFlag.
 

Detailed Description

Represents the PiaCommon namespace.

Typedef Documentation

typedef void(* nn::pia::common::InternalPrintCallback) (const char *pStr, s32 len)

The callback type passed to RegisterInternalPrintCallback.

Parameters
[in]pStrPointer to the head of the string. The string is not necessarily terminated by a null character.
[in]lenThe string length.

Defines the tracing flag type.

Use by passing it as the first argument to the PIA_TRACE macro.

Enumeration Type Documentation

Indicates the type of execution result.

Enumerator
EXECUTE_STATE_COMPLETE 

Indicates execution is not complete. Continue execution.

EXECUTE_STATE_CANCEL 

Indicates execution has completed.

EXECUTE_STATE_SUSPEND 

Indicates execution has been canceled. (Currently no different from COMPLETE.)

EXECUTE_STATE_WAIT 

Indicates execution was suspended.

EXECUTE_STATE_WAIT_NEXT 

Indicates execution is not complete, but will resume after a set period of time.

EXECUTE_STATE_CONTINUE_MAIN 

Indicates execution is not complete. Resume execution with the next call to Scheduler::Dispatch. Jobs in this state cannot be used in the background.

EXECUTE_STATE_CONTINUE_BACKGROUND 

Indicates execution is not complete. Next, execute in the main thread using the Dispatch function.

EXECUTE_STATE_MAX 

Indicates execution is not complete. The job will run in the background next.

Provided as a sentinel to indicate the last ExecuteState enumerated type.

This enumerated type represents the types of networks supported by Pia.

Enumerator
UDS_LOCAL_NETWORK 

UDS communication.

IPV4_INTERNET 

Internet communication using IPv4.

Function Documentation

nn::Result nn::pia::common::BeginSetup ( void  )

Declares the start of setup.

Call this function before creating a singleton in the common module. Always call this function and EndSetup even if your application does not create any singletons in the common module.

Returns
Returns a Result value indicating success if it is called at the right time. You must make sure that the implementation of this function in your application does not return any errors.
Error Return Values:

ResultNotInitialized The function for initializing the common module has not been called. Programming error. Fix your program so that this error is not returned.

ResultInvalidState Indicates that the function was called at the wrong time. Programming error. Fix your program so that this error is not returned.

nn::Result nn::pia::common::EndSetup ( void  )

Declares the end of setup.

Call this function after you are finished creating singletons and using other features of the common module. Calling this function configures memory to be used by the common module singletons and optimizes memory management within the library. Always call BeginSetup and this function even if your application does not create any singletons in the common module.

Returns
Returns a Result value indicating success if it is called at the right time. You must make sure that the implementation of this function in your application does not return any errors.
Error Return Values:

ResultNotInitialized The function for initializing the common module has not been called. Programming error. Fix your program so that this error is not returned.

ResultInvalidState Indicates that the function was called at the wrong time. Programming error. Fix your program so that this error is not returned.

void nn::pia::common::Finalize ( void  )

Finalizes the common module.

This function destroys the instance of nn::pia::common::Log created by the Initialize function, and frees the memory supplied to the Pia library by the application in the call to Initialize. This function does nothing if the common module is not initialized when it is called.

size_t nn::pia::common::GetMemoryUsage ( void  )

Gets the amount of memory being used by the Pia library at the point this function is called.

Do not call this function between the BeginSetup and EndSetup functions of each module. If you call this function, an incorrect value is returned.

Returns
Returns the amount of memory being used by the Pia library at the point this function was called. If the common module is not set up, or if internal errors occur, 0 is returned.
Error Return Values:
0 The Pia library has not been set up.
nn::Result nn::pia::common::Initialize ( void *  pMem,
u32  size 
)

Initializes the common module.

The heap used by the Pia library is configured during initialization. Next, the function sets up an instance of the nn::pia::common::Log class so that macros like PIA_LOG can be used. Pia uses thread-local storage implicitly to efficiently manage threads internally. For more information, see the Programming Manual.

Parameters
[in]pMemSpecifies a pointer to the start address of the memory block passed to the Pia library. The buffer must be 4-byte aligned.
[in]sizeSpecifies the size of the memory block passed in pMem. The value is in bytes. The library asserts and stops execution if the size is not large enough to construct the heap.
Returns
Returns a Result value indicating success if initialization succeeds. You must make sure that the implementation of this function in your application does not return any errors.
Error Return Values:

ResultInvalidArgument Specifies that an argument is invalid. Programming error. Fix your program so that this error is not returned.

ResultAlreadyInitialized The module is already initialized. Programming error. Fix your program so that this error is not returned.

bool nn::pia::common::IsInitialized ( void  )

Indicates whether the common module is initialized.

Returns
Returns true if initialized, and false otherwise.
InternalPrintCallback nn::pia::common::RegisterInternalPrintCallback ( InternalPrintCallback  pCallback)

Sets the callback that hooks the Pia console output.

Parameters
[in]pCallbackSpecifies a pointer to the callback function to register.
Returns
Returns a pointer to the callback function that was registered before this function was called. NULL is returned if no callback function was registered.