diff options
author | Martin Schanzenbach <mschanzenbach@posteo.de> | 2012-06-16 10:47:23 +0000 |
---|---|---|
committer | Martin Schanzenbach <mschanzenbach@posteo.de> | 2012-06-16 10:47:23 +0000 |
commit | 441e9af30c003a458227f106a75b98d3b1463be0 (patch) | |
tree | e4152c4029b9e92f84dc07b61a99a3c1ac43d3d1 /src | |
parent | c0cf6345215b55c20a5d84ae0604e499845ee989 (diff) | |
download | gnunet-441e9af30c003a458227f106a75b98d3b1463be0.tar.gz gnunet-441e9af30c003a458227f106a75b98d3b1463be0.zip |
-add vpn record type to namestore
Diffstat (limited to 'src')
-rw-r--r-- | src/include/gnunet_namestore_service.h | 5 | ||||
-rw-r--r-- | src/namestore/namestore_common.c | 19 |
2 files changed, 24 insertions, 0 deletions
diff --git a/src/include/gnunet_namestore_service.h b/src/include/gnunet_namestore_service.h index a484601a5..730f95112 100644 --- a/src/include/gnunet_namestore_service.h +++ b/src/include/gnunet_namestore_service.h | |||
@@ -64,6 +64,11 @@ extern "C" | |||
64 | #define GNUNET_NAMESTORE_TYPE_LEHO 65538 | 64 | #define GNUNET_NAMESTORE_TYPE_LEHO 65538 |
65 | 65 | ||
66 | /** | 66 | /** |
67 | * Record type for VPN resolution | ||
68 | */ | ||
69 | #define GNUNET_NAMESTORE_TYPE_VPN 65539 | ||
70 | |||
71 | /** | ||
67 | * Entry in the queue. | 72 | * Entry in the queue. |
68 | */ | 73 | */ |
69 | struct GNUNET_NAMESTORE_QueueEntry; | 74 | struct GNUNET_NAMESTORE_QueueEntry; |
diff --git a/src/namestore/namestore_common.c b/src/namestore/namestore_common.c index 95f6364a1..4ffeaebcf 100644 --- a/src/namestore/namestore_common.c +++ b/src/namestore/namestore_common.c | |||
@@ -376,6 +376,8 @@ GNUNET_NAMESTORE_value_to_string (uint32_t type, | |||
376 | return GNUNET_strndup (data, data_size); | 376 | return GNUNET_strndup (data, data_size); |
377 | case GNUNET_NAMESTORE_TYPE_LEHO: | 377 | case GNUNET_NAMESTORE_TYPE_LEHO: |
378 | return GNUNET_strndup (data, data_size); | 378 | return GNUNET_strndup (data, data_size); |
379 | case GNUNET_NAMESTORE_TYPE_VPN: | ||
380 | return GNUNET_strndup (data, data_size); | ||
379 | default: | 381 | default: |
380 | GNUNET_break (0); | 382 | GNUNET_break (0); |
381 | } | 383 | } |
@@ -414,6 +416,9 @@ GNUNET_NAMESTORE_string_to_value (uint32_t type, | |||
414 | uint32_t soa_retry; | 416 | uint32_t soa_retry; |
415 | uint32_t soa_expire; | 417 | uint32_t soa_expire; |
416 | uint32_t soa_min; | 418 | uint32_t soa_min; |
419 | struct GNUNET_HashCode hash; | ||
420 | struct GNUNET_CRYPTO_HashAsciiEncoded s_peer, s_serv; | ||
421 | int af, proto; | ||
417 | 422 | ||
418 | switch (type) | 423 | switch (type) |
419 | { | 424 | { |
@@ -495,6 +500,20 @@ GNUNET_NAMESTORE_string_to_value (uint32_t type, | |||
495 | *data = GNUNET_strdup (s); | 500 | *data = GNUNET_strdup (s); |
496 | *data_size = strlen (s); | 501 | *data_size = strlen (s); |
497 | return GNUNET_OK; | 502 | return GNUNET_OK; |
503 | case GNUNET_NAMESTORE_TYPE_VPN: | ||
504 | if (4 != SSCANF (s,"%d:%d:%s:%s", | ||
505 | &af, &proto, (char*)&s_peer, (char*)&s_serv)) | ||
506 | { | ||
507 | return GNUNET_SYSERR; | ||
508 | } | ||
509 | if ((GNUNET_OK != GNUNET_CRYPTO_hash_from_string ((char*)&s_peer, &hash)) || | ||
510 | (GNUNET_OK != GNUNET_CRYPTO_hash_from_string ((char*)&s_serv, &hash))) | ||
511 | { | ||
512 | return GNUNET_SYSERR; | ||
513 | } | ||
514 | *data = GNUNET_strdup (s); | ||
515 | *data_size = strlen (s); | ||
516 | return GNUNET_OK; | ||
498 | default: | 517 | default: |
499 | GNUNET_break (0); | 518 | GNUNET_break (0); |
500 | } | 519 | } |