HIPC  0.5
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
Functions
usocutils.c File Reference
#include <string.h>
#include <hipc/usoc.h>
#include <hipc/usocutils.h>
Include dependency graph for usocutils.c:

Go to the source code of this file.

Functions

enum HIPC_errno hipcUsocWriteMsgd (struct HIPC_usoc *const so_p, hipc_msgd const *const md_p)
 Writes md_p to so_p. More...
 
static enum HIPC_errno hipcUsocSendSysmsg (struct HIPC_usoc *const so_p, const struct HIPC_scfg *const cfg_p)
 Sends system messages of cfg_p. More...
 
enum HIPC_errno hipcUsocAccept (struct HIPC_usoc *const so_p, const struct HIPC_scfg **const cfg_pp, const struct HIPC_scfg *const *const cfg_ary, const unsigned int n_cfg, unsigned char *const buf, const size_t buf_size)
 Accepts a HIPC session if cfg_ary includes a configuration of coming HELLO message. More...
 
enum HIPC_errno hipcUsocAcceptSimple (struct HIPC_usoc *const so_p, const struct HIPC_scfg *const cfg_p)
 Accepts a HIPC session of cfg_p. More...
 

Function Documentation

enum HIPC_errno hipcUsocWriteMsgd ( struct HIPC_usoc *const  so_p,
hipc_msgd const *const  md_p 
)

Writes md_p to so_p.

Parameters
so_pPointer to a universal socket
md_pPointer to HIPC message data
Returns
HIPC_SUCCESS on success, or an error on failure.

Definition at line 14 of file usocutils.c.

References HIPC_MSGHDR_SIZE, HIPC_SUCCESS, hipcMsgdBdyPtr, hipcMsgdBdySize(), hipcMsgdHdrPtr, and hipcUsocWrite().

Referenced by hipcMain(), hipcsvsLedRun(), hipcsvsRtRun(), and test_hipcUsocWriteMsgd().

Here is the call graph for this function:

Here is the caller graph for this function:

static enum HIPC_errno hipcUsocSendSysmsg ( struct HIPC_usoc *const  so_p,
const struct HIPC_scfg *const  cfg_p 
)
static

Sends system messages of cfg_p.

Parameters
so_pPointer to a universal socket
cfg_pPointer to a configuration
Returns
HIPC_SUCCESS on success, or an error on failure.

Definition at line 40 of file usocutils.c.

References HIPC_SUCCESS, and hipcUsocWrite().

Referenced by hipcUsocAccept(), and hipcUsocAcceptSimple().

Here is the call graph for this function:

Here is the caller graph for this function:

enum HIPC_errno hipcUsocAccept ( struct HIPC_usoc *const  so_p,
const struct HIPC_scfg **const  cfg_pp,
const struct HIPC_scfg *const *const  cfg_ary,
const unsigned int  n_cfg,
unsigned char *const  buf,
const size_t  buf_size 
)

Accepts a HIPC session if cfg_ary includes a configuration of coming HELLO message.

Accepted configuration is set to cfg_pp.

Parameters
so_pPointer to a universal socket
cfg_ppConfiguration accepted
cfg_aryAcceptable configurations
n_cfgNumber of acceptable configurations
bufbuffer for HELLO message
buf_sizesize of the buffer
Returns
HIPC_SUCCESS on success, or an error on failure.

Definition at line 71 of file usocutils.c.

References HIPC_ERR_S_BUF_SHTG, HIPC_ERR_S_INV_CFG, HIPC_ERR_S_INV_NULL, HIPC_MSGHDR_SIZE, HIPC_SUCCESS, hipcMsghdrBdysize(), hipcScfgCheckStrusize(), hipcScfgInit(), hipcUsocRead(), and hipcUsocSendSysmsg().

Referenced by test_hipcUsocAccept().

Here is the call graph for this function:

Here is the caller graph for this function:

enum HIPC_errno hipcUsocAcceptSimple ( struct HIPC_usoc *const  so_p,
const struct HIPC_scfg *const  cfg_p 
)

Accepts a HIPC session of cfg_p.

This function use the stack for a buffer, so the stack size must be large enough.

Parameters
so_pPointer to a universal socket
cfg_pAcceptable configuration
Returns
HIPC_SUCCESS on success, or an error on failure.

Definition at line 141 of file usocutils.c.

References HIPC_scfg::cfgid, HIPC_scfg::cfgid_header, HIPC_ERR_S_INV_CFG, HIPC_ERR_S_INV_NULL, HIPC_MSGHDR_SIZE, HIPC_SUCCESS, hipcMsghdrBdysize(), hipcScfgCheckStrusize(), hipcScfgInit(), hipcUsocRead(), and hipcUsocSendSysmsg().

Referenced by hipcMain(), and test_hipcUsocAcceptSimple().

Here is the call graph for this function:

Here is the caller graph for this function: