X-Git-Url: https://tinc-vpn.org/git/browse?p=tinc;a=blobdiff_plain;f=src%2Fsptps_test.c;h=3ee7ab69b63eedaa862bc73275637ddbd8de3da8;hp=56dcc88634d4061ea01bd8ad5178736c817b0fde;hb=3a4fe104a06b73fd19c550546e7c65a59ff2afe3;hpb=03e06fd43aff73b4a5c9d367968a1279371ae252 diff --git a/src/sptps_test.c b/src/sptps_test.c index 56dcc886..3ee7ab69 100644 --- a/src/sptps_test.c +++ b/src/sptps_test.c @@ -51,9 +51,16 @@ static bool receive_record(void *handle, uint8_t type, const char *data, uint16_ int main(int argc, char *argv[]) { bool initiator = false; + bool datagram = false; - if(argc < 3) { - fprintf(stderr, "Usage: %s my_ecdsa_key_file his_ecdsa_key_file [host] port\n", argv[0]); + if(argc > 1 && !strcmp(argv[1], "-d")) { + datagram = true; + argc--; + argv++; + } + + if(argc < 4) { + fprintf(stderr, "Usage: %s [-d] my_ecdsa_key_file his_ecdsa_key_file [host] port\n", argv[0]); return 1; } @@ -123,7 +130,7 @@ int main(int argc, char *argv[]) { fprintf(stderr, "Keys loaded\n"); sptps_t s; - if(!sptps_start(&s, &sock, initiator, mykey, hiskey, "sptps_test", 10, send_data, receive_record)) + if(!sptps_start(&s, &sock, initiator, datagram, mykey, hiskey, "sptps_test", 10, send_data, receive_record)) return 1; while(true) {