Lines Matching refs:bgp_dump
34 #include "bgpd/bgp_dump.h"
60 struct bgp_dump
79 struct bgp_dump bgp_dump_all;
82 struct bgp_dump bgp_dump_updates;
85 struct bgp_dump bgp_dump_routes;
93 bgp_dump_open_file (struct bgp_dump *bgp_dump)
104 if (bgp_dump->filename[0] != DIRECTORY_SEP)
106 sprintf (fullpath, "%s/%s", vty_get_cwd (), bgp_dump->filename);
110 ret = strftime (realpath, MAXPATHLEN, bgp_dump->filename, tm);
118 if (bgp_dump->fp)
119 fclose (bgp_dump->fp);
122 bgp_dump->fp = fopen (realpath, "w");
124 if (bgp_dump->fp == NULL)
127 return bgp_dump->fp;
131 bgp_dump_interval_add (struct bgp_dump *bgp_dump, int interval)
135 bgp_dump->t_interval = thread_add_timer (master, bgp_dump_interval_func,
136 bgp_dump, interval);
300 struct bgp_dump *bgp_dump;
302 bgp_dump = THREAD_ARG (t);
303 bgp_dump->t_interval = NULL;
305 if (bgp_dump_open_file (bgp_dump) == NULL)
309 if (bgp_dump->type == BGP_DUMP_ROUTES)
315 bgp_dump_interval_add (bgp_dump, bgp_dump->interval);
389 bgp_dump_packet_func (struct bgp_dump *bgp_dump, struct peer *peer,
395 if (bgp_dump->fp == NULL)
413 fwrite (STREAM_DATA (obuf), stream_get_putp (obuf), 1, bgp_dump->fp);
414 fflush (bgp_dump->fp);
478 bgp_dump_set (struct vty *vty, struct bgp_dump *bgp_dump, int type,
493 bgp_dump->interval = interval;
494 if (bgp_dump->interval_str)
495 free (bgp_dump->interval_str);
496 bgp_dump->interval_str = strdup (interval_str);
499 bgp_dump_interval_add (bgp_dump, interval);
503 bgp_dump->type = type;
506 if (bgp_dump->filename)
507 free (bgp_dump->filename);
508 bgp_dump->filename = strdup (path);
511 bgp_dump_open_file (bgp_dump);
517 bgp_dump_unset (struct vty *vty, struct bgp_dump *bgp_dump)
520 if (bgp_dump->filename)
522 free (bgp_dump->filename);
523 bgp_dump->filename = NULL;
527 if (bgp_dump->fp)
529 fclose (bgp_dump->fp);
530 bgp_dump->fp = NULL;
534 if (bgp_dump->t_interval)
536 thread_cancel (bgp_dump->t_interval);
537 bgp_dump->t_interval = NULL;
540 bgp_dump->interval = 0;
542 if (bgp_dump->interval_str)
544 free (bgp_dump->interval_str);
545 bgp_dump->interval_str = NULL;
728 memset (&bgp_dump_all, 0, sizeof (struct bgp_dump));
729 memset (&bgp_dump_updates, 0, sizeof (struct bgp_dump));
730 memset (&bgp_dump_routes, 0, sizeof (struct bgp_dump));