|
|
@ -104,6 +104,42 @@ static int __rpcscheck_onclient(sxlink_t *l, int ch_tid, char *description)
|
|
|
|
return SXE_SUCCESS;
|
|
|
|
return SXE_SUCCESS;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
* This function might be used to output log in any format you like.
|
|
|
|
|
|
|
|
* In this case it is a prefix with a message type before a message body.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
static int __log(const sxlogtype_t type, const char *fmt, ...)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
int r = 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
switch(type) {
|
|
|
|
|
|
|
|
case SXCRITICAL_LOG:
|
|
|
|
|
|
|
|
r += fprintf(stderr, "[CRITICAL] ");
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SXERROR_LOG:
|
|
|
|
|
|
|
|
r += fprintf(stderr, "[ERROR] ");
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SXWARNING_LOG:
|
|
|
|
|
|
|
|
r += fprintf(stderr, "[WARNING] ");
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SXINFO_LOG:
|
|
|
|
|
|
|
|
r += fprintf(stderr, "[INFO] ");
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SXDEBUG_LOG:
|
|
|
|
|
|
|
|
r += fprintf(stderr, "[DEBUG] ");
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
|
|
|
r += fprintf(stderr, "[UNKNOWN] ");
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
va_list arglist;
|
|
|
|
|
|
|
|
va_start(arglist, fmt);
|
|
|
|
|
|
|
|
r += vfprintf(stderr, fmt, arglist);
|
|
|
|
|
|
|
|
va_end(arglist);
|
|
|
|
|
|
|
|
return r;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* supplemetary functions to make code more readable */
|
|
|
|
/* supplemetary functions to make code more readable */
|
|
|
|
static int __close_dir_stream(sxchnl_t *c, int sid)
|
|
|
|
static int __close_dir_stream(sxchnl_t *c, int sid)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -400,6 +436,9 @@ int main(int argc, char **argv)
|
|
|
|
lhub = sxhub_create(); /* create sxhub for link creation */
|
|
|
|
lhub = sxhub_create(); /* create sxhub for link creation */
|
|
|
|
if(!lhub) return ENOMEM;
|
|
|
|
if(!lhub) return ENOMEM;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* set sxhub log function */
|
|
|
|
|
|
|
|
sxhub_set_logops(lhub, __log);
|
|
|
|
|
|
|
|
|
|
|
|
i = sxhub_setsslserts(lhub, rootca, cert, cert);
|
|
|
|
i = sxhub_setsslserts(lhub, rootca, cert, cert);
|
|
|
|
if(i) return i;
|
|
|
|
if(i) return i;
|
|
|
|
|
|
|
|
|
|
|
|