I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Commit 61e5f190 authored by mpc's avatar mpc Committed by zzz
Browse files

Updated examples

parent a4946272
No related branches found
No related tags found
No related merge requests found
If you would like to make a donation to the author of this library, you can use
the following methods:
* E-Gold account number 1043280
* Paypal email mpc@innographx.com
If you want to use some other method, just ask.
I need to do these things:
* SAM raw support
* SAM raw support (partially complete)
* Write an instruction manual
* Make dest a dynamic string
* Change SAM parser to use a hashmap
......
/* vi:set ts=4: */
v1.30
* Removed stdint.h dependency
* Improved WIRETAP to do more logging
* Added "pinger.sh" shell script example for using i2p-ping
* Added SAM_BAD_STYLE error
......
......@@ -78,7 +78,7 @@ int main(int argc, char *argv[])
int count = INT_MAX; /* number of times to ping */
int pongcount = -1;
char *samhost = "localhost";
uint16_t samport = 7656;
unsigned short samport = 7656;
while ((ch = getopt(argc, argv, "ac:h:mp:qv")) != -1) {
switch (ch) {
......@@ -103,7 +103,7 @@ int main(int argc, char *argv[])
quiet = true;
break;
case 'v': /* version */
puts("$Id: i2p-ping.c,v 1.4 2004/09/22 20:05:40 jrandom Exp $");
puts("$Id: i2p-ping.c,v 1.5 2004/09/24 16:08:00 mpc Exp $");
puts("Copyright (c) 2004, Matthew P. Cashdollar <mpc@innographx.com>");
break;
case '?':
......@@ -140,7 +140,7 @@ int main(int argc, char *argv[])
pongcount = 0;
for (int j = 0; j < argc; j++) {
if (strlen(argv[j]) == 516) {
if (strlen(argv[j]) == SAM_PUBKEY_LEN - 1) {
memcpy(dest, argv[j], SAM_PUBKEY_LEN);
gotdest = true;
} else
......
......@@ -88,12 +88,12 @@ int main(int argc, char *argv[])
}
/*
* Check whether they've supplied a name or a base 64 destination
* Check whether they've supplied a hostname or a base 64 destination
*
* Note that this is a hack. Jrandom says that once certificates are added,
* the length could be different depending on the certificate's size.
*/
if (strlen(argv[1]) == 516) {
if (strlen(argv[1]) == SAM_PUBKEY_LEN - 1) {
memcpy(dest, argv[1], SAM_PUBKEY_LEN);
gotdest = true;
} else {
......@@ -155,7 +155,7 @@ static void dgramback(sam_sess_t *session, sam_pubkey_t dest, void *data,
static void diedback(sam_sess_t *session)
{
fprintf(stderr, "Lost SAM connection!\n");
/* high quality code would do a sam_session_free() here */
sam_session_free(&session);
exit(1);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment