bgpdump_lib.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*
  2. Copyright (c) 2007 - 2010 RIPE NCC - All Rights Reserved
  3. Permission to use, copy, modify, and distribute this software and its
  4. documentation for any purpose and without fee is hereby granted, provided
  5. that the above copyright notice appear in all copies and that both that
  6. copyright notice and this permission notice appear in supporting
  7. documentation, and that the name of the author not be used in advertising or
  8. publicity pertaining to distribution of the software without specific,
  9. written prior permission.
  10. THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  11. ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS; IN NO EVENT SHALL
  12. AUTHOR BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
  13. DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
  14. AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  15. OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  16. Parts of this code have been engineered after analiyzing GNU Zebra's
  17. source code and therefore might contain declarations/code from GNU
  18. Zebra, Copyright (C) 1999 Kunihiro Ishiguro. Zebra is a free routing
  19. software, distributed under the GNU General Public License. A copy of
  20. this license is included with libbgpdump.
  21. Original Author: Dan Ardelean (dan@ripe.net)
  22. */
  23. #ifndef _BGPDUMP_LIB_H
  24. #define _BGPDUMP_LIB_H
  25. #include <stdio.h>
  26. #define BGPDUMP_HAVE_IPV6
  27. #include "bgpdump_attr.h"
  28. #include "bgpdump_formats.h"
  29. #ifdef __cplusplus
  30. extern "C" {
  31. #endif
  32. #define BGPDUMP_MAX_FILE_LEN 1024
  33. #define BGPDUMP_MAX_AS_PATH_LEN 2000
  34. // if you include cfile_tools.h, include it first
  35. #ifndef _CFILE_TOOLS_DEFINES
  36. typedef struct _CFRFILE CFRFILE;
  37. #endif
  38. typedef struct struct_BGPDUMP {
  39. CFRFILE *f;
  40. int f_type;
  41. int eof;
  42. char filename[BGPDUMP_MAX_FILE_LEN];
  43. int parsed;
  44. int parsed_ok;
  45. BGPDUMP_TABLE_DUMP_V2_PEER_INDEX_TABLE *table_dump_v2_peer_index_table;
  46. } BGPDUMP;
  47. /* prototypes */
  48. BGPDUMP *bgpdump_open_dump(const char *filename);
  49. void bgpdump_close_dump(BGPDUMP *dump);
  50. BGPDUMP_ENTRY* bgpdump_read_next(BGPDUMP *dump);
  51. void bgpdump_free_mem(BGPDUMP_ENTRY *entry);
  52. char *bgpdump_version(void);
  53. int is_addpath(BGPDUMP_ENTRY *entry);
  54. #ifdef __cplusplus
  55. }
  56. #endif
  57. #endif