v0.5.xx
Alexander Vdolainen 10 years ago
parent c4d53c6f22
commit 438633a911

@ -259,6 +259,8 @@ int sntl_rpclist_filter(usrtc_t *source, usrtc_t **dest, int flag, int *filter);
}
#endif
#define blub(txt) fprintf(stderr, "%s:%d in %s > %s\n", __FILE__, __LINE__, __FUNCTION__, txt)
#endif /* __SNTL_SNTLLV2_H__ */

@ -130,8 +130,7 @@ static int __get_channels_list(void *cctx, sexp_t *sx)
if(ssys->get_rpc_typed_list_tree)
co->rpc_list = ssys->get_rpc_typed_list_tree(co);
if(!co->rpc_list) return SNE_EPERM;
buf += sizeof(sntllv2_head_t);
//buf += sizeof(sntllv2_head_t);
ulen += snprintf(buf + ulen, maxlen - ulen, "(set-channels-list ");
for(node = usrtc_first(co->rpc_list); node != NULL;
node = usrtc_next(co->rpc_list, node)) { /* fill the list */
@ -183,6 +182,7 @@ static int __set_channels_list(void *cctx, sexp_t *sx)
/* we're ready for messaging mode */
co->flags |= SNSX_MESSAGINGMODE;
co->flags &= ~SNSX_BATCHMODE;
return SNE_SUCCESS;
}

@ -752,7 +752,10 @@ conn_t *connection_master_link(conn_sys_t *ssys, int sck, struct in_addr *addr)
if(head->opcode != SNE_SUCCESS) { r = head->opcode; goto __fail3; }
else { /* opcode is fine */
/* if we're ready for messaging mode, turn off batch mode */
if(co->flags & SNSX_MESSAGINGMODE) co->flags &= ~SNSX_BATCHMODE;
if(co->flags & SNSX_MESSAGINGMODE) {
co->flags &= ~SNSX_BATCHMODE;
break;
}
}
if(!head->payload_length) continue; /* pass the following check up */
@ -768,6 +771,7 @@ conn_t *connection_master_link(conn_sys_t *ssys, int sck, struct in_addr *addr)
msg->mhead.payload_length = 0;
/* deal with it */
r = __eval_syssexp(co, sx);
memcpy(head, &msg->mhead, sizeof(sntllv2_head_t));
head->opcode = r;
if(r != SNE_SUCCESS) { /* we finish */
head->payload_length = 0;
@ -956,6 +960,7 @@ conn_t *connection_link(conn_sys_t *ssys, const char *host,
/* form a message -- credentials */
ln = snprintf(bbuf, 65535 - sizeof(sntllv2_head_t), "(auth-set-credentials \"%s\" \"%s\")",
login ? login : "nil", passwd ? passwd : "nil");
head->opcode = SNE_SUCCESS;
head->payload_length = ln;
wr = __conn_write(co, buf, ln + sizeof(sntllv2_head_t));
@ -963,12 +968,15 @@ conn_t *connection_link(conn_sys_t *ssys, const char *host,
rd = __conn_read(co, head, sizeof(sntllv2_head_t));
if(rd < 0) goto __fail2;
if(head->opcode != SNE_SUCCESS) goto __fail2;
if(head->opcode != SNE_SUCCESS) {
r = head->opcode;
goto __fail2;
}
/* ok, get available channels */
head->opcode = SNE_SUCCESS;
head->payload_length = ln;
ln = snprintf(bbuf, 65535 - sizeof(sntllv2_head_t), "(get-channels-list)");
head->payload_length = ln;
wr = __conn_write(co, buf, ln + sizeof(sntllv2_head_t));
if(wr < 0) goto __fail2;
@ -982,6 +990,7 @@ conn_t *connection_link(conn_sys_t *ssys, const char *host,
/* perform a parsing of the desired message */
bbuf[rd] = '\0';
sx = parse_sexp(bbuf, rd);
if(!sx) { r = SNE_BADPROTO; goto __fail2; }
r = __eval_syssexp(co, sx);
destroy_sexp(sx);
head->opcode = r;

@ -101,6 +101,7 @@ int main(int argc, char **argv)
return EINVAL;
}
sntl_init();
/* all is fine let's init connection subsystem */
ssys = connections_create();
if(!ssys) {

@ -81,7 +81,7 @@ static int __validate_sslpem(conn_t *co)
*/
static int __secure_check(conn_t *co)
{
return 0;
return SNE_SUCCESS;
}
/*
@ -215,7 +215,7 @@ int main(int argc, char **argv)
return EINVAL;
}
sntllv2_init();
sntl_init();
/* all is fine let's init connection subsystem */
if(!ssys) {
fprintf(stderr, "Subsystem init failed: %d\n", opt);

Loading…
Cancel
Save