|
@ -42,7 +42,7 @@ int32_t basilisk_ping_processMSG(struct supernet_info *myinfo,uint32_t senderipb |
|
|
int32_t i,msglen,len=0; uint8_t num,keylen,*msg,*key; |
|
|
int32_t i,msglen,len=0; uint8_t num,keylen,*msg,*key; |
|
|
if ( (num= data[len++]) > 0 ) |
|
|
if ( (num= data[len++]) > 0 ) |
|
|
{ |
|
|
{ |
|
|
printf("processMSG num.%d datalen.%d\n",num,datalen); |
|
|
//printf("processMSG num.%d datalen.%d\n",num,datalen);
|
|
|
for (i=0; i<num; i++) |
|
|
for (i=0; i<num; i++) |
|
|
{ |
|
|
{ |
|
|
keylen = data[len++]; |
|
|
keylen = data[len++]; |
|
@ -82,7 +82,7 @@ int32_t basilisk_ping_genMSG(struct supernet_info *myinfo,uint8_t *data,int32_t |
|
|
datalen += iguana_rwnum(1,&data[datalen],sizeof(msg->datalen),&msg->datalen); |
|
|
datalen += iguana_rwnum(1,&data[datalen],sizeof(msg->datalen),&msg->datalen); |
|
|
if ( maxlen > datalen+msg->datalen ) |
|
|
if ( maxlen > datalen+msg->datalen ) |
|
|
{ |
|
|
{ |
|
|
printf("SEND keylen.%d msglen.%d\n",msg->keylen,msg->datalen); |
|
|
//printf("SEND keylen.%d msglen.%d\n",msg->keylen,msg->datalen);
|
|
|
memcpy(&data[datalen],msg->data,msg->datalen), datalen += msg->datalen; |
|
|
memcpy(&data[datalen],msg->data,msg->datalen), datalen += msg->datalen; |
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
@ -137,7 +137,7 @@ char *basilisk_respond_OUT(struct supernet_info *myinfo,char *CMD,void *addr,cha |
|
|
int32_t keylen; uint8_t key[64]; |
|
|
int32_t keylen; uint8_t key[64]; |
|
|
keylen = basilisk_messagekey(key,hash,valsobj); |
|
|
keylen = basilisk_messagekey(key,hash,valsobj); |
|
|
//printf("keylen.%d datalen.%d\n",keylen,datalen);
|
|
|
//printf("keylen.%d datalen.%d\n",keylen,datalen);
|
|
|
char str[65]; printf("add message.[%d] channel.%u msgid.%x %s\n",datalen,juint(valsobj,"channel"),juint(valsobj,"msgid"),bits256_str(str,hash)); |
|
|
//char str[65]; printf("add message.[%d] channel.%u msgid.%x %s\n",datalen,juint(valsobj,"channel"),juint(valsobj,"msgid"),bits256_str(str,hash));
|
|
|
return(basilisk_respond_addmessage(myinfo,key,keylen,data,datalen,1)); |
|
|
return(basilisk_respond_addmessage(myinfo,key,keylen,data,datalen,1)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -145,7 +145,7 @@ char *basilisk_respond_MSG(struct supernet_info *myinfo,char *CMD,void *addr,cha |
|
|
{ |
|
|
{ |
|
|
int32_t keylen; uint8_t key[64]; |
|
|
int32_t keylen; uint8_t key[64]; |
|
|
keylen = basilisk_messagekey(key,hash,valsobj); |
|
|
keylen = basilisk_messagekey(key,hash,valsobj); |
|
|
char str[65]; printf("%s channel.%u msgid.%u datalen.%d\n",bits256_str(str,hash),juint(valsobj,"channel"),juint(valsobj,"msgid"),datalen); |
|
|
//char str[65]; printf("%s channel.%u msgid.%u datalen.%d\n",bits256_str(str,hash),juint(valsobj,"channel"),juint(valsobj,"msgid"),datalen);
|
|
|
return(basilisk_respond_getmessage(myinfo,key,keylen)); |
|
|
return(basilisk_respond_getmessage(myinfo,key,keylen)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -189,7 +189,7 @@ int32_t basilisk_channelsend(struct supernet_info *myinfo,bits256 hash,uint32_t |
|
|
valsobj = cJSON_CreateObject(); |
|
|
valsobj = cJSON_CreateObject(); |
|
|
jaddnum(valsobj,"channel",channel); |
|
|
jaddnum(valsobj,"channel",channel); |
|
|
jaddnum(valsobj,"msgid",msgid); |
|
|
jaddnum(valsobj,"msgid",msgid); |
|
|
char str[65]; printf("sendmessage.[%d] channel.%u msgid.%x -> %s\n",datalen,channel,msgid,bits256_str(str,hash)); |
|
|
//char str[65]; printf("sendmessage.[%d] channel.%u msgid.%x -> %s\n",datalen,channel,msgid,bits256_str(str,hash));
|
|
|
if ( (retstr= basilisk_sendmessage(myinfo,0,0,0,hash,valsobj,hexstr)) != 0 ) |
|
|
if ( (retstr= basilisk_sendmessage(myinfo,0,0,0,hash,valsobj,hexstr)) != 0 ) |
|
|
{ |
|
|
{ |
|
|
retval = 0; |
|
|
retval = 0; |
|
@ -230,7 +230,7 @@ int32_t basilisk_channelget(struct supernet_info *myinfo,bits256 hash,uint32_t c |
|
|
jaddnum(valsobj,"fanout",1); |
|
|
jaddnum(valsobj,"fanout",1); |
|
|
if ( (retstr= basilisk_getmessage(myinfo,0,0,0,hash,valsobj,0)) != 0 ) |
|
|
if ( (retstr= basilisk_getmessage(myinfo,0,0,0,hash,valsobj,0)) != 0 ) |
|
|
{ |
|
|
{ |
|
|
printf("gotmessage.(%s)\n",retstr); |
|
|
//printf("gotmessage.(%s)\n",retstr);
|
|
|
if ( (retarray= cJSON_Parse(retstr)) != 0 ) |
|
|
if ( (retarray= cJSON_Parse(retstr)) != 0 ) |
|
|
{ |
|
|
{ |
|
|
if ( is_cJSON_Array(retarray) != 0 ) |
|
|
if ( is_cJSON_Array(retarray) != 0 ) |
|
|