mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
cast parameters to unsigned char and terminal localhost regex without domain
This commit is contained in:
parent
e680d885d7
commit
c600835ad3
|
@ -28,7 +28,7 @@
|
||||||
|
|
||||||
//TODO: move this to network.h
|
//TODO: move this to network.h
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
#include "../nacl/build/Linux/include/amd64/crypto_box.h"
|
#include "../nacl/build/localhost/include/amd64/crypto_box.h" //${HOSTNAME%.*} doesn't work... set env var later
|
||||||
#endif
|
#endif
|
||||||
//Our public key.
|
//Our public key.
|
||||||
extern uint8_t self_public_key[crypto_box_PUBLICKEYBYTES];
|
extern uint8_t self_public_key[crypto_box_PUBLICKEYBYTES];
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
* If it recieves a message from a friend it replies back.
|
* If it recieves a message from a friend it replies back.
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* This is how I compile it: gcc -O2 -Wall -o test ../core/Lossless_UDP.c ../core/network.c ../core/net_crypto.c ../core/DHT.c ../core/Messenger.c ../nacl/build/$HOSTNAME/lib/amd64/* Messenger_test.c
|
* This is how I compile it: gcc -O2 -Wall -o test ../core/Lossless_UDP.c ../core/network.c ../core/net_crypto.c ../core/DHT.c ../core/Messenger.c ../nacl/build/${HOSTNAME%.*}/lib/amd64/* Messenger_test.c
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* Command line arguments are the ip and port of a node (for bootstrapping).
|
* Command line arguments are the ip and port of a node (for bootstrapping).
|
||||||
|
@ -57,7 +57,7 @@ void print_request(uint8_t * public_key, uint8_t * data, uint16_t length)
|
||||||
}
|
}
|
||||||
printf("\nOf length: %u with data: %s \n", length, data);
|
printf("\nOf length: %u with data: %s \n", length, data);
|
||||||
|
|
||||||
if(length != sizeof("Install Gentoo"))
|
if(length != sizeof((uint8_t*)"Install Gentoo"))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -72,7 +72,7 @@ void print_request(uint8_t * public_key, uint8_t * data, uint16_t length)
|
||||||
void print_message(int friendnumber, uint8_t * string, uint16_t length)
|
void print_message(int friendnumber, uint8_t * string, uint16_t length)
|
||||||
{
|
{
|
||||||
printf("Message with length %u recieved from %u: %s \n", length, friendnumber, string);
|
printf("Message with length %u recieved from %u: %s \n", length, friendnumber, string);
|
||||||
m_sendmessage(friendnumber, "Test1", 6);
|
m_sendmessage(friendnumber, (uint8_t*)"Test1", 6);
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
|
@ -85,7 +85,7 @@ int main(int argc, char *argv[])
|
||||||
m_callback_friendrequest(print_request);
|
m_callback_friendrequest(print_request);
|
||||||
m_callback_friendmessage(print_message);
|
m_callback_friendmessage(print_message);
|
||||||
|
|
||||||
m_setinfo("Install Gentoo", sizeof("Install Gentoo"));//The message we send is a message of peace
|
m_setinfo((uint8_t*)"Install Gentoo", sizeof((uint8_t*)"Install Gentoo"));//The message we send is a message of peace
|
||||||
|
|
||||||
printf("OUR ID: ");
|
printf("OUR ID: ");
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
|
@ -109,7 +109,7 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
while(1)
|
while(1)
|
||||||
{
|
{
|
||||||
m_sendmessage(num, "Test", 5);
|
m_sendmessage(num, (uint8_t*)"Test", 5);
|
||||||
doMessenger();
|
doMessenger();
|
||||||
c_sleep(30);
|
c_sleep(30);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user