Classes | Macros | Enumerations | Functions | Variables
bcap_server.c File Reference
#include "stdint.h"
#include <stdlib.h>
#include <string.h>
#include "dn_additional.h"
#include "dn_common.h"
#include "dn_device.h"
#include "dn_tcp.h"
#include "dn_udp.h"
#include "dn_com.h"
#include "dn_thread.h"
#include "bcap_common.h"
#include "bcap_mapid.h"
#include "bcap_server.h"
Include dependency graph for bcap_server.c:

Go to the source code of this file.

Classes

struct  CONN_BCAP_SERVER
 b-CAP server communication object. More...
 
struct  VEC_OBJECT
 A vector for stacking created objects. More...
 

Macros

#define _BCAP_SERVER_MAX   (BCAP_TCP_MAX + BCAP_UDP_MAX + BCAP_COM_MAX)
 A definition for the maximum count of servers. More...
 
#define _FUNCTION_ID_MAX   (137 + 1)
 A definition for the maximum count of b-CAP function IDs. More...
 

Enumerations

enum  CHANGE_RELATION { ADD_CHILD, DELETE_CHILD, DESTROY_SELF }
 change relation information. More...
 

Functions

static THRET THTYPE accept_thread (void *arg)
 The accepting thread for TCP connection. More...
 
static HRESULT bcap_callfunc (struct BCAP_PACKET *recv_packet, struct BCAP_PACKET *send_packet)
 Execute a callback function with the received b-CAP command. More...
 
HRESULT bCap_Close_Server (int *pfd)
 Ends b-CAP server. More...
 
HRESULT bCap_Open_Server (const char *connect, uint32_t timeout, int *pfd)
 Starts b-CAP server. More...
 
HRESULT bCap_SetCallFunc (int32_t id, CALL_FUNC_BCAP func)
 Sets a callback function. More...
 
static HRESULT change_relation (struct CONN_BCAP_SERVER *own, int mode, int *sock)
 Changes thread's relationships for TCP connection. More...
 
static struct CONN_BCAP_SERVERcheck_address (int index)
 Checks whether the index has been used or not. More...
 
static int check_lifelimit (struct CONN_BCAP_SERVER *parent)
 Checks the life limit all of child nodes, and if expired then deletes. More...
 
static THRET THTYPE exec_thread (void *arg)
 The executing thread. More...
 
static int find_open_address (int type)
 Returns the open address of m_conn_param. More...
 
static HRESULT pop_vector (struct CONN_BCAP_SERVER *bcap_param, struct VEC_OBJECT **pObj, int index)
 Pops the object where is in the indicated index from the vector. More...
 
static HRESULT push_vector (struct CONN_BCAP_SERVER *bcap_param, struct VEC_OBJECT *pObj)
 Pushes the created object to the vector. More...
 
static HRESULT receive_execute (struct CONN_BCAP_SERVER *bcap_param)
 Receives the b-CAP packet and executes callback functions. More...
 
static THRET THTYPE recv_thread (void *arg)
 The receiving thread. More...
 
static struct CONN_BCAP_SERVERsearch_node (struct CONN_BCAP_SERVER *parent, const void *arg, int size)
 Searches the target node which has a specified argument. More...
 
static int search_vector (struct CONN_BCAP_SERVER *bcap_param, int32_t id, uint32_t hObj)
 Searches the target object with function ID and object handle. More...
 

Variables

static struct CONN_BCAP_SERVER m_conn_param [_BCAP_SERVER_MAX]
 
static CALL_FUNC_BCAP m_list_func [_FUNCTION_ID_MAX]
 

Macro Definition Documentation

#define _BCAP_SERVER_MAX   (BCAP_TCP_MAX + BCAP_UDP_MAX + BCAP_COM_MAX)

A definition for the maximum count of servers.

Software License Agreement (MIT License)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Definition at line 56 of file bcap_server.c.

#define _FUNCTION_ID_MAX   (137 + 1)

A definition for the maximum count of b-CAP function IDs.

Definition at line 62 of file bcap_server.c.

Enumeration Type Documentation

change relation information.

Enumerator
ADD_CHILD 
DELETE_CHILD 

Add a child

DESTROY_SELF 

Delete all children

Definition at line 68 of file bcap_server.c.

Function Documentation

THRET accept_thread ( void *  arg)
static

The accepting thread for TCP connection.

Parameters
[in]argThe argument of accepting thread: CONN_BCAP_SERVER.

Definition at line 980 of file bcap_server.c.

HRESULT bcap_callfunc ( struct BCAP_PACKET recv_packet,
struct BCAP_PACKET send_packet 
)
static

Execute a callback function with the received b-CAP command.

Parameters
[in]recv_packetThe received b-CAP packet.
[in]send_packetThe b-CAP packet to be sent.

Definition at line 525 of file bcap_server.c.

HRESULT bCap_Close_Server ( int *  pfd)

Ends b-CAP server.

Parameters
[in,out]pfdThe pointer of File descriptor.

Definition at line 1184 of file bcap_server.c.

HRESULT bCap_Open_Server ( const char *  connect,
uint32_t  timeout,
int *  pfd 
)

Starts b-CAP server.

Parameters
[in]timeoutTimeout value.
[out]pfdThe pointer of File descriptor.

Definition at line 1056 of file bcap_server.c.

HRESULT bCap_SetCallFunc ( int32_t  id,
CALL_FUNC_BCAP  func 
)

Sets a callback function.

Parameters
[in]idThe b-CAP function ID.
[in]funcA callback function to be set.

Definition at line 1044 of file bcap_server.c.

HRESULT change_relation ( struct CONN_BCAP_SERVER own,
int  mode,
int *  sock 
)
static

Changes thread's relationships for TCP connection.

Parameters
[in,out]ownThe connection parameter to be changed.
[in]modeThe change mode.
[in]sockThe client connection.

Definition at line 315 of file bcap_server.c.

struct CONN_BCAP_SERVER * check_address ( int  index)
static

Checks whether the index has been used or not.

Parameters
[in]indexThe index of m_conn_param.
Note
If the index has not been used then returns NULL.

Definition at line 165 of file bcap_server.c.

int check_lifelimit ( struct CONN_BCAP_SERVER parent)
static

Checks the life limit all of child nodes, and if expired then deletes.

Parameters
[in]parentThe server object.

Definition at line 495 of file bcap_server.c.

THRET exec_thread ( void *  arg)
static

The executing thread.

Parameters
[in]argThe argument of executing thread: CONN_BCAP_SERVER.

Definition at line 841 of file bcap_server.c.

int find_open_address ( int  type)
static

Returns the open address of m_conn_param.

Parameters
[in]typeConnection type.
Note
If there is no open space, then returns 0.

Definition at line 127 of file bcap_server.c.

HRESULT pop_vector ( struct CONN_BCAP_SERVER bcap_param,
struct VEC_OBJECT **  pObj,
int  index 
)
static

Pops the object where is in the indicated index from the vector.

Parameters
[in]bcap_paramThe server object.
[out]pObjthe poped object.
[in]indexThe indicated index.

Definition at line 217 of file bcap_server.c.

HRESULT push_vector ( struct CONN_BCAP_SERVER bcap_param,
struct VEC_OBJECT pObj 
)
static

Pushes the created object to the vector.

Parameters
[in]bcap_paramThe server object.
[in]pObjThe created object to push.

Definition at line 186 of file bcap_server.c.

HRESULT receive_execute ( struct CONN_BCAP_SERVER bcap_param)
static

Receives the b-CAP packet and executes callback functions.

Parameters
[in,out]bcap_paramb-CAP communication object.

Definition at line 560 of file bcap_server.c.

static THRET THTYPE recv_thread ( void *  arg)
static

The receiving thread.

Parameters
[in]argThe argument of receiving thread: CONN_BCAP_SERVER.

Definition at line 880 of file bcap_server.c.

struct CONN_BCAP_SERVER * search_node ( struct CONN_BCAP_SERVER parent,
const void *  arg,
int  size 
)
static

Searches the target node which has a specified argument.

Parameters
[in]parentThe server object.
[in]argA specified argument.
[in]sizeThe size of argument.

Definition at line 291 of file bcap_server.c.

int search_vector ( struct CONN_BCAP_SERVER bcap_param,
int32_t  id,
uint32_t  hObj 
)
static

Searches the target object with function ID and object handle.

Parameters
[in]bcap_paramThe server object.
[in]idFunction ID.
[in]hObjObject handle.
Note
If it cannot find the target object, then returns -1.

Definition at line 266 of file bcap_server.c.

Variable Documentation

struct CONN_BCAP_SERVER m_conn_param[_BCAP_SERVER_MAX]
static

Definition at line 115 of file bcap_server.c.

CALL_FUNC_BCAP m_list_func[_FUNCTION_ID_MAX]
static

Definition at line 114 of file bcap_server.c.



bcap_core
Author(s): DENSO WAVE INCORPORATED
autogenerated on Mon Jun 10 2019 13:12:20