Tizen Native API  5.0
RPC Port Parcel

The RPC Port Parcel API provides functions to make parcel data.

Required Header

#include <rpc-port-parcel.h>

Overview

It is container for a data that can be sent via RPCPort.

Functions

int rpc_port_parcel_create (rpc_port_parcel_h *h)
 Creates a rpc port parcel handle.
int rpc_port_parcel_create_from_port (rpc_port_parcel_h *h, rpc_port_h port)
 Creates a rpc port parcel handle from port.
int rpc_port_parcel_send (rpc_port_parcel_h h, rpc_port_h port)
 Sends parcel data through the port.
int rpc_port_parcel_destroy (rpc_port_parcel_h h)
 Destroys a rpc port parcel handle.
int rpc_port_parcel_write_byte (rpc_port_parcel_h h, char b)
 Writes a byte value into rpc port parcel handle.
int rpc_port_parcel_write_int16 (rpc_port_parcel_h h, short i)
 Writes a short value into rpc port parcel handle.
int rpc_port_parcel_write_int32 (rpc_port_parcel_h h, int i)
 Writes a integer value into rpc port parcel handle.
int rpc_port_parcel_write_int64 (rpc_port_parcel_h h, long long i)
 Writes a long long integer value into rpc port parcel handle.
int rpc_port_parcel_write_float (rpc_port_parcel_h h, float f)
 Writes a floating point value into rpc port parcel handle.
int rpc_port_parcel_write_double (rpc_port_parcel_h h, double d)
 Writes a double precision floating point value into rpc port parcel handle.
int rpc_port_parcel_write_string (rpc_port_parcel_h h, const char *str)
 Writes a string value into rpc port parcel handle.
int rpc_port_parcel_write_bool (rpc_port_parcel_h h, bool b)
 Writes a boolean value into rpc port parcel handle.
int rpc_port_parcel_write_bundle (rpc_port_parcel_h h, bundle *b)
 Writes a bundle data into rpc port parcel handle.
int rpc_port_parcel_write_array_count (rpc_port_parcel_h h, int count)
 Writes a count for array into rpc port parcel handle.
int rpc_port_parcel_write (rpc_port_parcel_h h, rpc_port_parcelable_t *parcelable, void *data)
 Writes the data into parcel handle using parcelable.
int rpc_port_parcel_read_byte (rpc_port_parcel_h h, char *b)
 Reads a byte value from rpc port parcel handle.
int rpc_port_parcel_read_int16 (rpc_port_parcel_h h, short *i)
 Reads a short value from rpc port parcel handle.
int rpc_port_parcel_read_int32 (rpc_port_parcel_h h, int *i)
 Reads a integer value from rpc port parcel handle.
int rpc_port_parcel_read_int64 (rpc_port_parcel_h h, long long *i)
 Reads a long long integer value from rpc port parcel handle.
int rpc_port_parcel_read_float (rpc_port_parcel_h h, float *f)
 Reads a floating point value from rpc port parcel handle.
int rpc_port_parcel_read_double (rpc_port_parcel_h h, double *d)
 Reads a double precision floating point value from rpc port parcel handle.
int rpc_port_parcel_read_string (rpc_port_parcel_h h, char **str)
 Reads a string value from rpc port parcel handle.
int rpc_port_parcel_read_bool (rpc_port_parcel_h h, bool *b)
 Reads a boolean value from rpc port parcel handle.
int rpc_port_parcel_read_bundle (rpc_port_parcel_h h, bundle **b)
 Reads a bundle data from rpc port parcel handle.
int rpc_port_parcel_read_array_count (rpc_port_parcel_h h, int *count)
 Reads a count for array from rpc port parcel handle.
int rpc_port_parcel_read (rpc_port_parcel_h h, rpc_port_parcelable_t *parcelable, void *data)
 Reads a parcel from the data using parcelable.
int rpc_port_parcel_burst_read (rpc_port_parcel_h h, unsigned char *buf, unsigned int size)
 Reads bytes from rpc port parcel handle.
int rpc_port_parcel_burst_write (rpc_port_parcel_h h, const unsigned char *buf, unsigned int size)
 Write bytes to rpc port parcel handle.

Typedefs

typedef void * rpc_port_parcel_h
 The rpc port parcel handle.
typedef struct
__rpc_port_parcelable 
rpc_port_parcelable_t
 The interface for converting data to/from a parcel.

Typedef Documentation

typedef void* rpc_port_parcel_h

The rpc port parcel handle.

Since :
5.0

The interface for converting data to/from a parcel.

Since :
5.0

Function Documentation

int rpc_port_parcel_burst_read ( rpc_port_parcel_h  h,
unsigned char *  buf,
unsigned int  size 
)

Reads bytes from rpc port parcel handle.

Since :
5.0
Parameters:
[in]hThe rpc port parcel handle
[out]bufThe array buffer to read
[in]sizeBytes to read
Returns:
0 on success, otherwise a negative error value
Return values:
RPC_PORT_ERROR_NONESuccessful
RPC_PORT_ERROR_INVALID_PARAMETERThe specified h is NULL
See also:
rpc_port_parcel_write_bool()
int rpc_port_parcel_burst_write ( rpc_port_parcel_h  h,
const unsigned char *  buf,
unsigned int  size 
)

Write bytes to rpc port parcel handle.

Since :
5.0
Parameters:
[in]hThe rpc port parcel handle
[in]bufThe array buffer to write
[in]sizeBytes to write
Returns:
0 on success, otherwise a negative error value
Return values:
RPC_PORT_ERROR_NONESuccessful
RPC_PORT_ERROR_INVALID_PARAMETERThe specified h is NULL
See also:
rpc_port_parcel_write_bool()

Creates a rpc port parcel handle.

Since :
5.0
Remarks:
You must release h using rpc_port_parcel_destroy().
Parameters:
[out]hThe rpc port parcel handle that is newly created
Returns:
0 on success, otherwise a negative error value
Return values:
RPC_PORT_ERROR_NONESuccessful
See also:
rpc_port_parcel_destroy()

Creates a rpc port parcel handle from port.

Creates a rpc port parcel handle using read data from the port. It calls rpc_port_read() internally.

Since :
5.0
Remarks:
You must release h using rpc_port_parcel_destroy().
Parameters:
[out]hThe rpc port parcel handle that is newly created
[in]portThe rpc port handle for creating handle
Returns:
0 on success, otherwise a negative error value
Return values:
RPC_PORT_ERROR_NONESuccessful
RPC_PORT_ERROR_INVALID_PARAMETERThe specified port is NULL
RPC_PORT_ERROR_IO_ERRORInternal I/O error
See also:
rpc_port_parcel_destroy()
rpc_port_parcel_send()

Destroys a rpc port parcel handle.

Since :
5.0
Parameters:
[in]hThe rpc port parcel handle
Returns:
0 on success, otherwise a negative error value
Return values:
RPC_PORT_ERROR_NONESuccessful
RPC_PORT_ERROR_INVALID_PARAMETERThe specified h is NULL
See also:
rpc_port_parcel_create()
int rpc_port_parcel_read ( rpc_port_parcel_h  h,
rpc_port_parcelable_t parcelable,
void *  data 
)

Reads a parcel from the data using parcelable.

Since :
5.0
Parameters:
[in]hThe rpc port parcel handle
[in]parcelableThe interface to get data from parcel handle
[in]dataData which get from parcel
Returns:
0 on success, otherwise a negative error value
Return values:
RPC_PORT_ERROR_NONESuccessful
RPC_PORT_ERROR_INVALID_PARAMETERThe specified h is NULL
See also:
rpc_port_parcel_write()

Reads a count for array from rpc port parcel handle.

Since :
5.0
Parameters:
[in]hThe rpc port parcel handle
[out]countArray count
Returns:
0 on success, otherwise a negative error value
Return values:
RPC_PORT_ERROR_NONESuccessful
RPC_PORT_ERROR_INVALID_PARAMETERThe specified h is NULL
See also:
rpc_port_parcel_write_array_count()
int rpc_port_parcel_read_bool ( rpc_port_parcel_h  h,
bool *  b 
)

Reads a boolean value from rpc port parcel handle.

Since :
5.0
Parameters:
[in]hThe rpc port parcel handle
[out]bboolean data
Returns:
0 on success, otherwise a negative error value
Return values:
RPC_PORT_ERROR_NONESuccessful
RPC_PORT_ERROR_INVALID_PARAMETERThe specified h is NULL
See also:
rpc_port_parcel_write_bool()

Reads a bundle data from rpc port parcel handle.

Since :
5.0
Remarks:
The b should be released using bundle_free().
Parameters:
[in]hThe rpc port parcel handle
[out]bBundle data
Returns:
0 on success, otherwise a negative error value
Return values:
RPC_PORT_ERROR_NONESuccessful
RPC_PORT_ERROR_INVALID_PARAMETERThe specified h is NULL
See also:
rpc_port_parcel_write_bundle()
int rpc_port_parcel_read_byte ( rpc_port_parcel_h  h,
char *  b 
)

Reads a byte value from rpc port parcel handle.

Since :
5.0
Parameters:
[in]hThe rpc port parcel handle
[out]bByte data
Returns:
0 on success, otherwise a negative error value
Return values:
RPC_PORT_ERROR_NONESuccessful
RPC_PORT_ERROR_INVALID_PARAMETERThe specified h is NULL
See also:
rpc_port_parcel_write_byte()
int rpc_port_parcel_read_double ( rpc_port_parcel_h  h,
double *  d 
)

Reads a double precision floating point value from rpc port parcel handle.

Since :
5.0
Parameters:
[in]hThe rpc port parcel handle
[out]ddouble data
Returns:
0 on success, otherwise a negative error value
Return values:
RPC_PORT_ERROR_NONESuccessful
RPC_PORT_ERROR_INVALID_PARAMETERThe specified h is NULL
See also:
rpc_port_parcel_write_double()
int rpc_port_parcel_read_float ( rpc_port_parcel_h  h,
float *  f 
)

Reads a floating point value from rpc port parcel handle.

Since :
5.0
Parameters:
[in]hThe rpc port parcel handle
[out]ffloat data
Returns:
0 on success, otherwise a negative error value
Return values:
RPC_PORT_ERROR_NONESuccessful
RPC_PORT_ERROR_INVALID_PARAMETERThe specified h is NULL
See also:
rpc_port_parcel_write_float()
int rpc_port_parcel_read_int16 ( rpc_port_parcel_h  h,
short *  i 
)

Reads a short value from rpc port parcel handle.

Since :
5.0
Parameters:
[in]hThe rpc port parcel handle
[out]ishort data
Returns:
0 on success, otherwise a negative error value
Return values:
RPC_PORT_ERROR_NONESuccessful
RPC_PORT_ERROR_INVALID_PARAMETERThe specified h is NULL
See also:
rpc_port_parcel_write_int16()

Reads a integer value from rpc port parcel handle.

Since :
5.0
Parameters:
[in]hThe rpc port parcel handle
[out]iint data
Returns:
0 on success, otherwise a negative error value
Return values:
RPC_PORT_ERROR_NONESuccessful
RPC_PORT_ERROR_INVALID_PARAMETERThe specified h is NULL
See also:
rpc_port_parcel_write_int32()
int rpc_port_parcel_read_int64 ( rpc_port_parcel_h  h,
long long *  i 
)

Reads a long long integer value from rpc port parcel handle.

Since :
5.0
Parameters:
[in]hThe rpc port parcel handle
[out]ilong long data
Returns:
0 on success, otherwise a negative error value
Return values:
RPC_PORT_ERROR_NONESuccessful
RPC_PORT_ERROR_INVALID_PARAMETERThe specified h is NULL
See also:
rpc_port_parcel_write_int64()
int rpc_port_parcel_read_string ( rpc_port_parcel_h  h,
char **  str 
)

Reads a string value from rpc port parcel handle.

Since :
5.0
Remarks:
The str should be released using free().
Parameters:
[in]hThe rpc port parcel handle
[out]strstring data
Returns:
0 on success, otherwise a negative error value
Return values:
RPC_PORT_ERROR_NONESuccessful
RPC_PORT_ERROR_INVALID_PARAMETERThe specified h is NULL
See also:
rpc_port_parcel_write_string()

Sends parcel data through the port.

Sends parcel data through the port. It calls rpc_port_write() internally.

Since :
5.0
Parameters:
[in]hThe rpc port parcel handle that is newly created
[in]portThe rpc port handle for writing data
Returns:
0 on success, otherwise a negative error value
Return values:
RPC_PORT_ERROR_NONESuccessful
RPC_PORT_ERROR_INVALID_PARAMETERThe specified h is NULL
RPC_PORT_ERROR_IO_ERRORInternal I/O error
See also:
rpc_port_parcel_create_from_port()
int rpc_port_parcel_write ( rpc_port_parcel_h  h,
rpc_port_parcelable_t parcelable,
void *  data 
)

Writes the data into parcel handle using parcelable.

Since :
5.0
Parameters:
[in]hThe rpc port parcel handle
[in]parcelableThe interface to write the data into parcel handle
[in]dataData which write into parcel
Returns:
0 on success, otherwise a negative error value
Return values:
RPC_PORT_ERROR_NONESuccessful
RPC_PORT_ERROR_INVALID_PARAMETERThe specified h is NULL
See also:
rpc_port_parcel_read()

Writes a count for array into rpc port parcel handle.

Since :
5.0
Parameters:
[in]hThe rpc port parcel handle
[in]countArray count
Returns:
0 on success, otherwise a negative error value
Return values:
RPC_PORT_ERROR_NONESuccessful
RPC_PORT_ERROR_INVALID_PARAMETERThe specified h is NULL
See also:
rpc_port_parcel_read_array_count()

Writes a boolean value into rpc port parcel handle.

Since :
5.0
Parameters:
[in]hThe rpc port parcel handle
[in]bboolean data
Returns:
0 on success, otherwise a negative error value
Return values:
RPC_PORT_ERROR_NONESuccessful
RPC_PORT_ERROR_INVALID_PARAMETERThe specified h is NULL
See also:
rpc_port_parcel_read_bool()

Writes a bundle data into rpc port parcel handle.

Since :
5.0
Parameters:
[in]hThe rpc port parcel handle
[in]bBundle data
Returns:
0 on success, otherwise a negative error value
Return values:
RPC_PORT_ERROR_NONESuccessful
RPC_PORT_ERROR_INVALID_PARAMETERThe specified h is NULL
See also:
rpc_port_parcel_read_bundle()

Writes a byte value into rpc port parcel handle.

Since :
5.0
Parameters:
[in]hThe rpc port parcel handle
[in]bByte data
Returns:
0 on success, otherwise a negative error value
Return values:
RPC_PORT_ERROR_NONESuccessful
RPC_PORT_ERROR_INVALID_PARAMETERThe specified h is NULL
See also:
rpc_port_parcel_read_byte()

Writes a double precision floating point value into rpc port parcel handle.

Since :
5.0
Parameters:
[in]hThe rpc port parcel handle
[in]ddouble data
Returns:
0 on success, otherwise a negative error value
Return values:
RPC_PORT_ERROR_NONESuccessful
RPC_PORT_ERROR_INVALID_PARAMETERThe specified h is NULL
See also:
rpc_port_parcel_read_double()

Writes a floating point value into rpc port parcel handle.

Since :
5.0
Parameters:
[in]hThe rpc port parcel handle
[in]ffloat data
Returns:
0 on success, otherwise a negative error value
Return values:
RPC_PORT_ERROR_NONESuccessful
RPC_PORT_ERROR_INVALID_PARAMETERThe specified h is NULL
See also:
rpc_port_parcel_read_float()

Writes a short value into rpc port parcel handle.

Since :
5.0
Parameters:
[in]hThe rpc port parcel handle
[in]ishort data
Returns:
0 on success, otherwise a negative error value
Return values:
RPC_PORT_ERROR_NONESuccessful
RPC_PORT_ERROR_INVALID_PARAMETERThe specified h is NULL
See also:
rpc_port_parcel_read_int16()

Writes a integer value into rpc port parcel handle.

Since :
5.0
Parameters:
[in]hThe rpc port parcel handle
[in]iint data
Returns:
0 on success, otherwise a negative error value
Return values:
RPC_PORT_ERROR_NONESuccessful
RPC_PORT_ERROR_INVALID_PARAMETERThe specified h is NULL
See also:
rpc_port_parcel_read_int32()
int rpc_port_parcel_write_int64 ( rpc_port_parcel_h  h,
long long  i 
)

Writes a long long integer value into rpc port parcel handle.

Since :
5.0
Parameters:
[in]hThe rpc port parcel handle
[in]ilong long data
Returns:
0 on success, otherwise a negative error value
Return values:
RPC_PORT_ERROR_NONESuccessful
RPC_PORT_ERROR_INVALID_PARAMETERThe specified h is NULL
See also:
rpc_port_parcel_read_int64()
int rpc_port_parcel_write_string ( rpc_port_parcel_h  h,
const char *  str 
)

Writes a string value into rpc port parcel handle.

Since :
5.0
Parameters:
[in]hThe rpc port parcel handle
[in]strstring data
Returns:
0 on success, otherwise a negative error value
Return values:
RPC_PORT_ERROR_NONESuccessful
RPC_PORT_ERROR_INVALID_PARAMETERThe specified h is NULL
See also:
rpc_port_parcel_read_string()