Add ercp_connect() call to ERCP interface
This is used by sesman to connect to sockets in the restart directory.
This commit is contained in:
@@ -81,6 +81,32 @@ ercp_trans_from_eicp_trans(struct trans *trans,
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
struct trans *
|
||||
ercp_connect(const char *port, int (*term_func)(void))
|
||||
{
|
||||
struct trans *t;
|
||||
|
||||
if ((t = trans_create(TRANS_MODE_UNIX, 128, 128)) != NULL)
|
||||
{
|
||||
t->is_term = term_func;
|
||||
|
||||
if (trans_connect(t, NULL, port, 3000) != 0)
|
||||
{
|
||||
trans_delete(t);
|
||||
t = NULL;
|
||||
}
|
||||
else if (ercp_init_trans(t) != 0)
|
||||
{
|
||||
trans_delete(t);
|
||||
t = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
return t;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
int
|
||||
ercp_msg_in_check_available(struct trans *trans, int *available)
|
||||
{
|
||||
|
||||
@@ -88,6 +88,16 @@ ercp_trans_from_eicp_trans(struct trans *trans,
|
||||
ttrans_data_in callback_func,
|
||||
void *callback_data);
|
||||
|
||||
/**
|
||||
* Connects to an ERCP endpoint.
|
||||
*
|
||||
* @param port Path to UDS object in filesystem
|
||||
* @param term_func Function to poll during connection for program
|
||||
* termination, or NULL for none.
|
||||
*/
|
||||
struct trans *
|
||||
ercp_connect(const char *port,
|
||||
int (*term_func)(void));
|
||||
|
||||
/**
|
||||
* Checks an ERCP transport to see if a complete message is
|
||||
|
||||
Reference in New Issue
Block a user