anode-zone-test.c 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /* libanode: the Anode C reference implementation
  2. * Copyright (C) 2009 Adam Ierymenko <[email protected]>
  3. *
  4. * This program is free software: you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation, either version 3 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program. If not, see <http://www.gnu.org/licenses/>. */
  16. #include <stdio.h>
  17. #include <string.h>
  18. #include <stdlib.h>
  19. #include "../anode.h"
  20. #include "../dictionary.h"
  21. static int got_it = 0;
  22. static void zone_lookup_handler(void *ptr,long zone_id,AnodeZone *zone)
  23. {
  24. if (zone)
  25. printf("got %.8lx: %d entries\n",(unsigned long)zone_id & 0xffffffff,((struct AnodeDictionary *)zone)->size);
  26. else printf("failed.\n");
  27. got_it = 1;
  28. }
  29. int main(int argc,char **argv)
  30. {
  31. AnodeTransportEngine transport;
  32. Anode_init_ip_transport_engine(&transport);
  33. AnodeZone_lookup(&transport,0,0,&zone_lookup_handler);
  34. while (!got_it)
  35. transport.poll(&transport);
  36. transport.destroy(&transport);
  37. return 0;
  38. }