diff options
Diffstat (limited to 'src/include/gnunet_identity_service.h')
-rw-r--r-- | src/include/gnunet_identity_service.h | 60 |
1 files changed, 48 insertions, 12 deletions
diff --git a/src/include/gnunet_identity_service.h b/src/include/gnunet_identity_service.h index 8084a3a98..64799f195 100644 --- a/src/include/gnunet_identity_service.h +++ b/src/include/gnunet_identity_service.h | |||
@@ -406,6 +406,42 @@ GNUNET_IDENTITY_key_get_length (const struct GNUNET_IDENTITY_PublicKey *key); | |||
406 | 406 | ||
407 | 407 | ||
408 | /** | 408 | /** |
409 | * Reads a #GNUNET_IDENTITY_PublicKey from a compact buffer. | ||
410 | * The buffer has to contain at least the compacted length of | ||
411 | * a #GNUNET_IDENTITY_PublicKey in bytes. | ||
412 | * If the buffer is too small, the function returns -1 as error. | ||
413 | * If the buffer does not contain a valid key, it returns -2 as error. | ||
414 | * | ||
415 | * @param key the key | ||
416 | * @param buffer the buffer | ||
417 | * @param len the length of buffer | ||
418 | * @return -1 or -2 on error, else the amount of bytes read from the buffer | ||
419 | */ | ||
420 | ssize_t | ||
421 | GNUNET_IDENTITY_read_key_from_buffer (struct GNUNET_IDENTITY_PublicKey *key, | ||
422 | const void* buffer, | ||
423 | size_t len); | ||
424 | |||
425 | |||
426 | /** | ||
427 | * Writes a #GNUNET_IDENTITY_PublicKey to a compact buffer. | ||
428 | * The buffer requires space for at least the compacted length of | ||
429 | * a #GNUNET_IDENTITY_PublicKey in bytes. | ||
430 | * If the buffer is too small, the function returns -1 as error. | ||
431 | * If the key is not valid, it returns -2 as error. | ||
432 | * | ||
433 | * @param key the key | ||
434 | * @param buffer the buffer | ||
435 | * @param len the length of buffer | ||
436 | * @return -1 or -2 on error, else the amount of bytes written to the buffer | ||
437 | */ | ||
438 | ssize_t | ||
439 | GNUNET_IDENTITY_write_key_to_buffer (const struct GNUNET_IDENTITY_PublicKey *key, | ||
440 | void* buffer, | ||
441 | size_t len); | ||
442 | |||
443 | |||
444 | /** | ||
409 | * Get the compacted length of a #GNUNET_IDENTITY_Signature. | 445 | * Get the compacted length of a #GNUNET_IDENTITY_Signature. |
410 | * Compacted means that it returns the minimum number of bytes this | 446 | * Compacted means that it returns the minimum number of bytes this |
411 | * signature is long, as opposed to the union structure inside | 447 | * signature is long, as opposed to the union structure inside |
@@ -420,39 +456,39 @@ GNUNET_IDENTITY_signature_get_length (const struct GNUNET_IDENTITY_Signature *si | |||
420 | 456 | ||
421 | 457 | ||
422 | /** | 458 | /** |
423 | * Reads a #GNUNET_IDENTITY_PublicKey from a compact buffer. | 459 | * Reads a #GNUNET_IDENTITY_Signature from a compact buffer. |
424 | * The buffer has to contain at least the compacted length of | 460 | * The buffer has to contain at least the compacted length of |
425 | * a #GNUNET_IDENTITY_PublicKey bytes. | 461 | * a #GNUNET_IDENTITY_Signature in bytes. |
426 | * If the buffer is too small, the function returns -1 as error. | 462 | * If the buffer is too small, the function returns -1 as error. |
427 | * If the buffer does not contain a valid key, it returns -2 as error. | 463 | * If the buffer does not contain a valid key, it returns -2 as error. |
428 | * | 464 | * |
429 | * @param key the key | 465 | * @param sig the signature |
430 | * @param buffer the buffer | 466 | * @param buffer the buffer |
431 | * @param len the length of buffer | 467 | * @param len the length of buffer |
432 | * @return -1 or -2 on error, else the amount of bytes read from the buffer | 468 | * @return -1 or -2 on error, else the amount of bytes read from the buffer |
433 | */ | 469 | */ |
434 | ssize_t | 470 | ssize_t |
435 | GNUNET_IDENTITY_read_key_from_buffer (struct GNUNET_IDENTITY_PublicKey *key, | 471 | GNUNET_IDENTITY_read_signature_from_buffer (struct GNUNET_IDENTITY_Signature *sig, |
436 | const void* buffer, | 472 | const void* buffer, |
437 | size_t len); | 473 | size_t len); |
438 | 474 | ||
439 | 475 | ||
440 | /** | 476 | /** |
441 | * Writes a #GNUNET_IDENTITY_PublicKey to a compact buffer. | 477 | * Writes a #GNUNET_IDENTITY_Signature to a compact buffer. |
442 | * The buffer requires space for at least the compacted length of | 478 | * The buffer requires space for at least the compacted length of |
443 | * a #GNUNET_IDENTITY_PublicKey in bytes. | 479 | * a #GNUNET_IDENTITY_Signature in bytes. |
444 | * If the buffer is too small, the function returns -1 as error. | 480 | * If the buffer is too small, the function returns -1 as error. |
445 | * If the key is not valid, it returns -2 as error. | 481 | * If the key is not valid, it returns -2 as error. |
446 | * | 482 | * |
447 | * @param key the key | 483 | * @param sig the signature |
448 | * @param buffer the buffer | 484 | * @param buffer the buffer |
449 | * @param len the length of buffer | 485 | * @param len the length of buffer |
450 | * @return -1 or -2 on error, else the amount of bytes written to the buffer | 486 | * @return -1 or -2 on error, else the amount of bytes written to the buffer |
451 | */ | 487 | */ |
452 | ssize_t | 488 | ssize_t |
453 | GNUNET_IDENTITY_write_key_to_buffer (const struct GNUNET_IDENTITY_PublicKey *key, | 489 | GNUNET_IDENTITY_write_signature_to_buffer (const struct GNUNET_IDENTITY_Signature *sig, |
454 | void* buffer, | 490 | void* buffer, |
455 | size_t len); | 491 | size_t len); |
456 | 492 | ||
457 | 493 | ||
458 | /** | 494 | /** |