diff options
author | Bart Polot <bart@net.in.tum.de> | 2012-11-22 18:02:45 +0000 |
---|---|---|
committer | Bart Polot <bart@net.in.tum.de> | 2012-11-22 18:02:45 +0000 |
commit | 8a83bf0dd1b5ed1037b3445097d03b644fabd844 (patch) | |
tree | 28f23bf5b7399506a2482fd1fc35c484ad35a8f6 /src/include | |
parent | 74e7bb910aef410888f92fdff592ebc592757c12 (diff) | |
download | gnunet-8a83bf0dd1b5ed1037b3445097d03b644fabd844.tar.gz gnunet-8a83bf0dd1b5ed1037b3445097d03b644fabd844.zip |
- API additions for monitor tunnel
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/gnunet_mesh_service.h | 56 | ||||
-rw-r--r-- | src/include/gnunet_protocols.h | 5 |
2 files changed, 58 insertions, 3 deletions
diff --git a/src/include/gnunet_mesh_service.h b/src/include/gnunet_mesh_service.h index 43cbd9af4..beabbc5df 100644 --- a/src/include/gnunet_mesh_service.h +++ b/src/include/gnunet_mesh_service.h | |||
@@ -437,28 +437,78 @@ GNUNET_MESH_notify_transmit_ready_cancel (struct GNUNET_MESH_TransmitHandle | |||
437 | * @param npeers Number of peers in peers. | 437 | * @param npeers Number of peers in peers. |
438 | */ | 438 | */ |
439 | typedef void (*GNUNET_MESH_MonitorCB) (void *cls, | 439 | typedef void (*GNUNET_MESH_MonitorCB) (void *cls, |
440 | const struct GNUNET_PeerIdentity *initiator, | 440 | const struct GNUNET_PeerIdentity *owner, |
441 | unsigned int tunnel_number, | 441 | unsigned int tunnel_number, |
442 | const struct GNUNET_PeerIdentity *peers, | 442 | const struct GNUNET_PeerIdentity *peers, |
443 | unsigned int npeers); | 443 | unsigned int npeers); |
444 | 444 | ||
445 | 445 | ||
446 | /** | 446 | /** |
447 | * Method called to retrieve information about each tunnel the mesh peer | ||
448 | * is aware of. | ||
449 | * | ||
450 | * @param cls Closure. | ||
451 | * @param initiator Peer that started the tunnel (owner). | ||
452 | * @param tunnel_number Tunnel number. | ||
453 | * @param peers Array of peers that form the tunnel, including transit nodes. | ||
454 | * The identities come in pairs, representing a peer | ||
455 | * and his predecessor in the tree. The root does not | ||
456 | * appear in the array. | ||
457 | * @param npeers Number of peers in peers (size is 2 x npeers!). | ||
458 | */ | ||
459 | typedef void (*GNUNET_MESH_MonitorTunnelCB) ( | ||
460 | void *cls, | ||
461 | const struct GNUNET_PeerIdentity *owner, | ||
462 | unsigned int tunnel_number, | ||
463 | const struct GNUNET_PeerIdentity *peers, | ||
464 | unsigned int npeers); | ||
465 | |||
466 | |||
467 | /** | ||
447 | * Request information about the running mesh peer. | 468 | * Request information about the running mesh peer. |
469 | * The callback will be called for every tunnel known to the service, | ||
470 | * listing all peers that blong to the tunnel (active only). | ||
471 | * | ||
472 | * If called again on the same handle, it will overwrite the previous | ||
473 | * callback and cls. To retrieve the cls, monitor_cancel must be | ||
474 | * called first. | ||
475 | * | ||
476 | * WARNING: unstable API, likely to change in the future! | ||
448 | * | 477 | * |
449 | * @param h Handle to the mesh peer. | 478 | * @param h Handle to the mesh peer. |
450 | * @param callback Function to call with the requested data. | 479 | * @param callback Function to call with the requested data. |
451 | * @param monitor_cls Closure for @c callback. | 480 | * @param callback_cls Closure for @c callback. |
452 | */ | 481 | */ |
453 | void | 482 | void |
454 | GNUNET_MESH_monitor (struct GNUNET_MESH_Handle *h, | 483 | GNUNET_MESH_monitor (struct GNUNET_MESH_Handle *h, |
455 | GNUNET_MESH_MonitorCB callback, | 484 | GNUNET_MESH_MonitorCB callback, |
456 | void *monitor_cls); | 485 | void *callback_cls); |
486 | |||
487 | |||
488 | /** | ||
489 | * Request information about a specific tunnel of the running mesh peer. | ||
490 | * | ||
491 | * WARNING: unstable API, likely to change in the future! | ||
492 | * | ||
493 | * @param h Handle to the mesh peer. | ||
494 | * @param initiator ID of the owner of the tunnel. | ||
495 | * @param tunnel_number Tunnel number. | ||
496 | * @param callback Function to call with the requested data. | ||
497 | * @param callback_cls Closure for @c callback. | ||
498 | */ | ||
499 | void | ||
500 | GNUNET_MESH_monitor_tunnel (struct GNUNET_MESH_Handle *h, | ||
501 | struct GNUNET_PeerIdentity *initiator, | ||
502 | unsigned int tunnel_number, | ||
503 | GNUNET_MESH_MonitorTunnelCB callback, | ||
504 | void *callback_cls); | ||
457 | 505 | ||
458 | 506 | ||
459 | /** | 507 | /** |
460 | * Cancel a monitor request. The monitor callback will not be called. | 508 | * Cancel a monitor request. The monitor callback will not be called. |
461 | * | 509 | * |
510 | * WARNING: unstable API, likely to change in the future! | ||
511 | * | ||
462 | * @param h Mesh handle. | 512 | * @param h Mesh handle. |
463 | * | 513 | * |
464 | * @return Closure given to GNUNET_MESH_monitor, if any. | 514 | * @return Closure given to GNUNET_MESH_monitor, if any. |
diff --git a/src/include/gnunet_protocols.h b/src/include/gnunet_protocols.h index 21ebbfdfe..2f84b0ade 100644 --- a/src/include/gnunet_protocols.h +++ b/src/include/gnunet_protocols.h | |||
@@ -886,6 +886,11 @@ extern "C" | |||
886 | #define GNUNET_MESSAGE_TYPE_MESH_LOCAL_MONITOR 287 | 886 | #define GNUNET_MESSAGE_TYPE_MESH_LOCAL_MONITOR 287 |
887 | 887 | ||
888 | /** | 888 | /** |
889 | * Local monitoring of service of a specific tunnel. | ||
890 | */ | ||
891 | #define GNUNET_MESSAGE_TYPE_MESH_LOCAL_MONITOR_TUNNEL 288 | ||
892 | |||
893 | /** | ||
889 | * 640kb should be enough for everybody | 894 | * 640kb should be enough for everybody |
890 | */ | 895 | */ |
891 | #define GNUNET_MESSAGE_TYPE_MESH_RESERVE_END 299 | 896 | #define GNUNET_MESSAGE_TYPE_MESH_RESERVE_END 299 |