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:
matt335672
2024-12-02 18:15:08 +00:00
parent 360d23f922
commit f7f64c8db2
2 changed files with 36 additions and 0 deletions
+26
View File
@@ -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)
{
+10
View File
@@ -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