Beispiel #1
0
int garden_print_appconn(struct app_conn_t *appconn, void *d) {
  char line[512];
  int fd = * (int *) d;
#ifdef HAVE_PATRICIA
  void cb (prefix_t *prefix, void *data) {
    struct node_pass_through_list *nd =
        (struct node_pass_through_list *)data;
    garden_print_list(fd, nd->ptlist, nd->ptcnt);
  }
#endif
  if (appconn->s_params.pass_through_count > 0) {
    safe_snprintf(line, sizeof line,
		  "subscriber %s (%d/%d):\n",
		  inet_ntoa(appconn->hisip),
		  appconn->s_params.pass_through_count,
		  SESSION_PASS_THROUGH_MAX);
    if (!safe_write(fd, line, strlen(line))) /* error */;
#ifdef HAVE_PATRICIA
    if (appconn->ptree) {
      patricia_process(appconn->ptree, cb);
    } else
#endif
      garden_print_list(fd,
			appconn->s_params.pass_throughs,
			appconn->s_params.pass_through_count);
  }
  return 0;
}
Beispiel #2
0
void garden_print(int fd)
{
	char line[512];

#ifdef HAVE_PATRICIA
	void cb(prefix_t * prefix, void *data) {
		struct node_pass_through_list *nd =
		    (struct node_pass_through_list *)data;
		garden_print_list(fd, nd->ptlist, nd->ptcnt);
	}
#endif

	safe_snprintf(line, sizeof line,
		      "static garden (%d/%d):\n",
		      _options.num_pass_throughs, MAX_PASS_THROUGHS);
	if (!safe_write(fd, line, strlen(line)))	/* error */
		;

#ifdef HAVE_PATRICIA
	if (dhcp->ptree) {
		patricia_process(dhcp->ptree, cb);
	} else
#endif
		garden_print_list(fd,
				  _options.pass_throughs,
				  _options.num_pass_throughs);

	safe_snprintf(line, sizeof line,
		      "dynamic garden (%d/%d):\n",
		      dhcp->num_pass_throughs, MAX_PASS_THROUGHS);
	if (!safe_write(fd, line, strlen(line)))	/* error */
		;

#ifdef HAVE_PATRICIA
	if (dhcp->ptree_dyn) {
		patricia_process(dhcp->ptree_dyn, cb);
	} else
#endif
		garden_print_list(fd,
				  dhcp->pass_throughs, dhcp->num_pass_throughs);

#ifdef ENABLE_SESSGARDEN
	chilli_appconn_run(garden_print_appconn, &fd);
#endif
}