コード例 #1
0
ファイル: http_engine.c プロジェクト: niks3089/nixia
char *
http_engine_setup_worker_directories()
{
    static int worker_id = 0;

    char dir_name[MAX_NAME_LENGTH] = {0};
    char worker_id_str[10] = {0};
    struct stat st = {0};
    int error = 0;
    http_config_t *global_config = http_config_get();

    sprintf(worker_id_str, "%d", ++worker_id);

    /* Setup directory name */
    strncpy(dir_name, global_config->output_directory,
            strlen(global_config->output_directory));
    strcat(dir_name, "/worker_");
    strncat(dir_name, worker_id_str, strlen(worker_id_str));

    if (stat(dir_name, &st) == -1) {
        zlog_info(log_get_cat(), "Creating directory: %s", dir_name);
        error = mkdir(dir_name, 0777);
    }

    if (error) {
        return NULL;
    }
    return(strdup(dir_name));
}
コード例 #2
0
int
twoway_received (struct thread *thread)
{
  struct ospf6_neighbor *on;

  on = (struct ospf6_neighbor *) THREAD_ARG (thread);
  assert (on);

  if (on->state > OSPF6_NEIGHBOR_INIT)
    return 0;

  if (IS_OSPF6_DEBUG_NEIGHBOR (EVENT))
    zlog_info ("Neighbor Event %s: *2Way-Received*", on->name);

  thread_add_event (master, neighbor_change, on->ospf6_if, 0);

  if (! need_adjacency (on))
    {
      ospf6_neighbor_state_change (OSPF6_NEIGHBOR_TWOWAY, on);
      return 0;
    }

  ospf6_neighbor_state_change (OSPF6_NEIGHBOR_EXSTART, on);
  SET_FLAG (on->dbdesc_bits, OSPF6_DBDESC_MSBIT);
  SET_FLAG (on->dbdesc_bits, OSPF6_DBDESC_MBIT);
  SET_FLAG (on->dbdesc_bits, OSPF6_DBDESC_IBIT);

  THREAD_OFF (on->thread_send_dbdesc);
  on->thread_send_dbdesc =
    thread_add_event (master, ospf6_dbdesc_send, on, 0);

  return 0;
}
コード例 #3
0
int
bad_lsreq (struct thread *thread)
{
  struct ospf6_neighbor *on;
  struct ospf6_lsa *lsa;

  on = (struct ospf6_neighbor *) THREAD_ARG (thread);
  assert (on);

  if (on->state < OSPF6_NEIGHBOR_EXCHANGE)
    return 0;

  if (IS_OSPF6_DEBUG_NEIGHBOR (EVENT))
    zlog_info ("Neighbor Event %s: *BadLSReq*", on->name);

  ospf6_neighbor_state_change (OSPF6_NEIGHBOR_EXSTART, on);
  SET_FLAG (on->dbdesc_bits, OSPF6_DBDESC_MSBIT);
  SET_FLAG (on->dbdesc_bits, OSPF6_DBDESC_MBIT);
  SET_FLAG (on->dbdesc_bits, OSPF6_DBDESC_IBIT);

  ospf6_lsdb_remove_all (on->summary_list);
  ospf6_lsdb_remove_all (on->request_list);
  for (lsa = ospf6_lsdb_head (on->retrans_list); lsa;
       lsa = ospf6_lsdb_next (lsa))
    {
      ospf6_decrement_retrans_count (lsa);
      ospf6_lsdb_remove (lsa, on->retrans_list);
    }

  THREAD_OFF (on->thread_send_dbdesc);
  on->thread_send_dbdesc =
    thread_add_event (master, ospf6_dbdesc_send, on, 0);

  return 0;
}
コード例 #4
0
void DrawBox(WINDOW* win, int height, int width, int starty, int startx, bool isFirst, bool isLast)
{
	mvwhline(win, starty, startx + 1, ACS_HLINE, width  );
	mvwhline(win, starty + height - 1, startx + 1, ACS_HLINE, width );
	mvwvline(win, starty + 1, startx, ACS_VLINE, height - 2 );
	//mvwvline(win, starty + 1 , width + startx, ACS_VLINE, height - 2 );
	zlog_info(c, "Drawing box (h=%3d, w=%3d, starty=%3d, startx=%3d, f=%d, l=%d",
		  height,
		  width,
		  starty,
		  startx,
		  isFirst,
		  isLast);

	wmove(win, starty + 1, startx + 2);  wprintw(win, "%d,%d,%d", startx, starty, (starty % 3));


	if (isFirst) {
		wmove(win, starty, startx); waddch(win, ACS_ULCORNER);
		wmove(win, starty + height - 1, startx); waddch(win, ACS_LLCORNER);
	}
	if (!isLast) {
		wmove(win, starty, startx + width); waddch(win, ACS_TTEE);
		wmove(win, starty + height - 1, startx + width); waddch(win, ACS_BTEE);
	}else{
		wmove(win, starty, startx + width); waddch(win, ACS_URCORNER);
		wmove(win, starty + height - 1, startx + width); waddch(win, ACS_LRCORNER);
		mvwvline(win, starty + 1, width + startx, ACS_VLINE, height - 2 );

	}


}
コード例 #5
0
ファイル: ripng_interface.c プロジェクト: DorChen/quagga
int
ripng_interface_delete (int command, struct zclient *zclient,
			zebra_size_t length)
{
  struct interface *ifp;
  struct stream *s;

  s = zclient->ibuf;
  /*  zebra_interface_state_read() updates interface structure in iflist */
  ifp = zebra_interface_state_read(s);

  if (ifp == NULL)
    return 0;

  if (if_is_up (ifp)) {
    ripng_if_down(ifp);
  }

  zlog_info("interface delete %s index %d flags %#llx metric %d mtu %d",
            ifp->name, ifp->ifindex, (unsigned long long) ifp->flags,
	    ifp->metric, ifp->mtu6);

  /* To support pseudo interface do not free interface structure.  */
  /* if_delete(ifp); */
  ifp->ifindex = IFINDEX_INTERNAL;

  return 0;
}
コード例 #6
0
ファイル: pim_zebra.c プロジェクト: gvsurenderreddy/quagga
static int pim_zebra_if_state_up(int command, struct zclient *zclient,
				 zebra_size_t length)
{
  struct interface *ifp;

  /*
    zebra api notifies interface up/down events by using the same call
    zebra_interface_state_read below, see comments in lib/zclient.c
  */
  ifp = zebra_interface_state_read(zclient->ibuf);
  if (!ifp)
    return 0;

  zlog_info("INTERFACE UP: %s ifindex=%d", ifp->name, ifp->ifindex);

  if (PIM_DEBUG_ZEBRA) {
    zlog_debug("%s: %s index %d flags %ld metric %d mtu %d operative %d",
	       __PRETTY_FUNCTION__,
	       ifp->name, ifp->ifindex, (long)ifp->flags, ifp->metric,
	       ifp->mtu, if_is_operative(ifp));
  }

  if (if_is_operative(ifp)) {
    /*
      pim_if_addr_add_all() suffices for bringing up both IGMP and PIM
    */
    pim_if_addr_add_all(ifp);
  }

  return 0;
}
コード例 #7
0
ファイル: ospf_neighbor.c プロジェクト: yubo/quagga
/* Delete specified OSPF neighbor from interface. */
void ospf_nbr_delete(struct ospf_neighbor *nbr)
{
	struct ospf_interface *oi;
	struct route_node *rn;
	struct prefix p;

	oi = nbr->oi;

	/* get appropriate prefix 'key' */
	ospf_nbr_key(oi, nbr, &p);

	rn = route_node_lookup(oi->nbrs, &p);
	if (rn) {
		/* If lookup for a NBR succeeds, the leaf route_node could
		 * only exist because there is (or was) a nbr there.
		 * If the nbr was deleted, the leaf route_node should have
		 * lost its last refcount too, and be deleted.
		 * Therefore a looked-up leaf route_node in nbrs table
		 * should never have NULL info.
		 */
		assert(rn->info);

		if (rn->info) {
			rn->info = NULL;
			route_unlock_node(rn);
		} else
			zlog_info("Can't find neighbor %s in the interface %s",
				  inet_ntoa(nbr->src), IF_NAME(oi));

		route_unlock_node(rn);
	}

	/* Free ospf_neighbor structure. */
	ospf_nbr_free(nbr);
}
コード例 #8
0
int
ospf6_damp_debug_thread (struct thread *thread)
{
    int i;
    struct ospf6_damp_info *di;
    char buf[256];
    time_t t_now;
    struct timeval now;

    for (i = 0; i < dc->reuse_list_size; i++)
    {
        for (di = dc->reuse_list_array[i]; di; di = di->next)
        {
            t_now = time (NULL);
            gettimeofday (&now, NULL);
            prefix2str (&di->name, buf, sizeof (buf));
            zlog_info ("DAMP: %lu.%06lu %c %-32s penalty %7u",
                       now.tv_sec, now.tv_usec,
                       (di->damping == ON ? 'D' : 'A'), buf,
                       (u_int) (di->penalty *
                                ospf6_damp_decay (t_now - di->t_updated)));
        }
    }
    thread_add_timer (master, ospf6_damp_debug_thread, NULL, 1);
    return 0;
}
コード例 #9
0
static struct ospf6_damp_info *
ospf6_damp_create (u_short type, struct prefix *name)
{
    struct route_node *node;
    struct ospf6_damp_info *di;
    char namebuf[64];

    di = ospf6_damp_lookup (type, name);
    if (di)
        return di;

    if (IS_OSPF6_DEBUG_DAMP)
    {
        prefix2str (name, namebuf, sizeof (namebuf));
        zlog_info ("DAMP: create: type: %d, name: %s", type, namebuf);
    }

    di = (struct ospf6_damp_info *)
         malloc (sizeof (struct ospf6_damp_info));
    memset (di, 0, sizeof (struct ospf6_damp_info));
    di->type = type;
    prefix_copy (&di->name, name);

    node = route_node_get (damp_info_table[type], name);
    node->info = di;

    return di;
}
コード例 #10
0
/* Delete specified OSPF neighbor from interface. */
void
ospf_nbr_delete (struct ospf_neighbor *nbr)
{
  struct ospf_interface *oi;
  struct route_node *rn;
  struct prefix p;

  oi = nbr->oi;

  /* Unlink ospf neighbor from the interface. */
  p.family = AF_INET;
  p.prefixlen = IPV4_MAX_BITLEN;
  p.u.prefix4 = nbr->src;

  rn = route_node_lookup (oi->nbrs, &p);
  if (rn)
    {
      if (rn->info)
	{
	  rn->info = NULL;
	  route_unlock_node (rn);
	}
      else
	zlog_info ("Can't find neighbor %s in the interface %s",
		   inet_ntoa (nbr->src), IF_NAME (oi));

      route_unlock_node (rn);
    }

  /* Free ospf_neighbor structure. */
  ospf_nbr_free (nbr);
}
コード例 #11
0
/* When we quit damping for a target, we should execute proper event
   which have been postponed during damping */
static void
ospf6_damp_stop (struct ospf6_damp_info *di)
{
    time_t t_now;
    char namebuf[64];
    struct timeval now;

    if (IS_OSPF6_DEBUG_DAMP)
    {
        t_now = time (NULL);
        prefix2str (&di->name, namebuf, sizeof (namebuf));
        gettimeofday (&now, NULL);
        zlog_info ("DAMP: %lu.%06lu stop damping: %ld: type: %d, name: %s",
                   now.tv_sec, now.tv_usec,
                   t_now, di->type, namebuf);
    }

    /* set flag indicates that we're damping this target */
    di->damping = OFF;

    /* if the target's current status differ from that it should be,
       execute the proper event to repair his status */
    if (di->target_status != di->event_type)
    {
        (*(di->event)) (di->target);
        di->target_status = di->event_type;

        di->event = NULL;
        di->event_type = event_none;
    }
}
コード例 #12
0
ファイル: bfd_ioctl.c プロジェクト: thehajime/zebra-manemo
static int
bfd_ioctl_state_change (struct bfd_nl_peerinfo *peerinfo)
{
	struct bfd_peer peer;
	struct zserv *client;
	struct listnode *node;


	if (IS_ZEBRA_DEBUG_KERNEL)
		zlog_info ("rcvd peerinfo %s: state=%d, ifindex=%d",
		    sockunion_log ((union sockunion *) &peerinfo->dst),
		    peerinfo->state, peerinfo->ifindex);

	memcpy (&peer.su, &peerinfo->dst.sa, sizeof (union sockunion));
	peer.ifindex = peerinfo->ifindex;

	if (peerinfo->state == BSM_Up)
	{
		for (node = listhead (client_list); node; nextnode (node))
			if ((client = getdata (node)) != NULL)
				zsend_bfd_peer_up (client, &peer);
	}
	else if (peerinfo->state == BSM_Down)
	{
		for (node = listhead (client_list); node; nextnode (node))
			if ((client = getdata (node)) != NULL)
				zsend_bfd_peer_down (client, &peer);
	}
	else
	{
	}

	return 0;
}
コード例 #13
0
ファイル: test_level.c プロジェクト: 3van/zlog
int main(int argc, char** argv)
{
	int rc;
	zlog_category_t *zc;

	rc = zlog_init("test_level.conf");
	if (rc) {
		printf("init failed\n");
		return -1;
	}

	zc = zlog_get_category("my_cat");
	if (!zc) {
		printf("get cat fail\n");
		zlog_fini();
		return -2;
	}

	zlog_trace(zc, "hello, zlog - trace");
	zlog_debug(zc, "hello, zlog - debug");
	zlog_info(zc, "hello, zlog - info");

	zlog_fini();
	
	return 0;
}
コード例 #14
0
ファイル: test_hello.c プロジェクト: Akagi201/zlog
int main(int argc, char** argv)
{
	int rc = 0;
	zlog_category_t *zc = NULL;

	// 初始化库, 给出配置文件路径
	rc = zlog_init("test_hello.conf");
	if (rc) {
		printf("init failed\n");
		return -1;
	}

	// 获取分类名, 表示要打印哪些日志
	zc = zlog_get_category("my_cat");
	if (!zc) {
		printf("get cat fail\n");
		zlog_fini();
		return -2;
	}

	zlog_info(zc, "hello, zlog");

	zlog_fini();
	
	return 0;
}
コード例 #15
0
ファイル: test_bitmap.c プロジェクト: JoKaWare/WinZlog
int zlog_test()
{
	int rc;
	zlog_category_t *c;

	rc = zlog_init("d:\\tmp\\zlog.conf");
	if (rc) {
		printf("init failed\n");
		return -1;
	}

	c = zlog_get_category("my_cat");
	if (!c) {
		printf("get cat fail\n");
		zlog_fini();

		return -2;
	}


	zlog_info(c, "hello, zlog");
	zlog_debug(c, "hello, zlog");
	zlog_error(c, "hello, zlog");

	zlog_fini();
	printf("exit.\n");

	return 0;
} 
コード例 #16
0
void
smux_parse_get (char *ptr, size_t len, int exact)
{
  long reqid;
  oid oid[MAX_OID_LEN];
  size_t oid_len;
  u_char val_type;
  void *val;
  size_t val_len;
  int ret;

  if (debug_smux)
    zlog_info ("SMUX GET message parse: len %d", len);
  
  /* Parse GET message header. */
  ptr = smux_parse_get_header (ptr, &len, &reqid);
  
  /* Parse GET message object ID. We needn't the value come */
  ptr = smux_var (ptr, len, oid, &oid_len, NULL, NULL, NULL);

  /* Traditional getstatptr. */
  if (exact)
    ret = smux_get (oid, &oid_len, exact, &val_type, &val, &val_len);
  else
    ret = smux_getnext (oid, &oid_len, exact, &val_type, &val, &val_len);

  /* Return result. */
  if (ret == 0)
    smux_getresp_send (oid, oid_len, reqid, 0, 0, val_type, val, val_len);
  else
    smux_getresp_send (oid, oid_len, reqid, ret, 3, ASN_NULL, NULL, 0);
}
コード例 #17
0
ファイル: ioctl.c プロジェクト: thehajime/zebra-manemo
/* get interface MTU */
void
if_get_mtu (struct interface *ifp)
{
  struct ifreq ifreq;

  ifreq_set_name (&ifreq, ifp);

#if defined(SIOCGIFMTU)
  if (if_ioctl (SIOCGIFMTU, (caddr_t) & ifreq) < 0) 
    {
      zlog_info ("Can't lookup mtu by ioctl(SIOCGIFMTU)");
      ifp->mtu = -1;
      return;
    }

#ifdef SUNOS_5
  ifp->mtu = ifreq.ifr_metric;
#else
  ifp->mtu = ifreq.ifr_mtu;
#endif /* SUNOS_5 */

#else
  zlog (NULL, LOG_INFO, "Can't lookup mtu on this system");
  ifp->mtu = -1;
#endif
}
コード例 #18
0
int
nsm_kill_nbr (struct ospf_neighbor *nbr)
{
  /* call it here because we cannot call it from ospf_nsm_event */
  nsm_change_status (nbr, NSM_Down);
  
  /* Reset neighbor. */
  nsm_reset_nbr (nbr);

  if (nbr->oi->type == OSPF_IFTYPE_NBMA && nbr->nbr_static != NULL)
    {
      struct ospf_nbr_static *nbr_static = nbr->nbr_static;

      nbr_static->neighbor = NULL;
      nbr_static->state_change = nbr->state_change;

      nbr->nbr_static = NULL;

      OSPF_POLL_TIMER_ON (nbr_static->t_poll, ospf_poll_timer,
			  nbr_static->v_poll);

      if (IS_DEBUG_OSPF (nsm, NSM_EVENTS))
	zlog_info ("NSM[%s:%s]: Down (PollIntervalTimer scheduled)",
		   IF_NAME (nbr->oi),
		   inet_ntoa (nbr->address.u.prefix4));  
    }

  /* Delete neighbor from interface. */
  ospf_nbr_delete (nbr);

  return 0;
}
コード例 #19
0
/* Set interface flags */
int
if_set_flags (struct interface_FOO *ifp, uint64_t flags)
{
  int ret;
  struct lifreq lifreq;

  lifreq_set_name (&lifreq, ifp->name);

  lifreq.lifr_flags = ifp->flags;
  lifreq.lifr_flags |= flags;

  if (ifp->flags & IFF_IPV4)
    ret = AF_IOCTL (AF_INET, SIOCSLIFFLAGS, (caddr_t) & lifreq);
  else if (ifp->flags & IFF_IPV6)
    ret = AF_IOCTL (AF_INET6, SIOCSLIFFLAGS, (caddr_t) & lifreq);
  else
    ret = -1;

  if (ret < 0)
    zlog_info ("can't set interface flags on %s: %s", ifp->name,
               safe_strerror (errno));
  else
    ret = 0;
    
  return ret;
}
コード例 #20
0
ファイル: pim_ssmpingd.c プロジェクト: gvsurenderreddy/quagga
int pim_ssmpingd_start(struct in_addr source_addr)
{
  struct ssmpingd_sock *ss;

  ss = ssmpingd_find(source_addr);
  if (ss) {
    /* silently ignore request to recreate entry */
    return 0;
  }

  {
    char source_str[100];
    pim_inet4_dump("<src?>", source_addr, source_str, sizeof(source_str));
    zlog_info("%s: starting ssmpingd for source %s",
	      __PRETTY_FUNCTION__, source_str);
  }

  ss = ssmpingd_new(source_addr);
  if (!ss) {
    char source_str[100];
    pim_inet4_dump("<src?>", source_addr, source_str, sizeof(source_str));
    zlog_warn("%s: ssmpingd_new() failure for source %s",
	      __PRETTY_FUNCTION__, source_str);
    return -1;
  }

  return 0;
}
コード例 #21
0
ファイル: change_rules.c プロジェクト: yang5022/Temp
int main(int argc, char** argv)
{
	int rc = 0;
	int j = 100;

    	rc = zlog_init("change_rule.conf");
    	if (rc){
    		printf("init failed\n");
        	return 2;
    	}

	zlog_category_t *zc;
	zc = zlog_get_category("yang");

	pthread_t  tid;
	pthread_create(&tid, NULL, work, (void*)("yang"));
	
	while(j-- > 0) {
		zlog_debug(zc, "debuglog");
		zlog_info(zc, "infolog");
		zlog_error(zc, "errorlog");
		sleep(1);
	}

	pthread_join(tid, NULL);
	zlog_fini();
	
	return 0;
}
コード例 #22
0
int delete_rpa_interface(struct interface * ifp)
{
	int fd, ret;
	struct rpa_interface_info rpa_info;

	zlog_info(" Go to detele rpa interface %s .\n",ifp->name);
	ifp->slot = get_slot_num(ifp->name);
	rpa_info.slotNum = ifp->slot - 1;
	rpa_info.netdevNum = ifp->devnum;
	fd = open(DEV_NAME, O_RDWR);
	if(fd < 0)
	{
		zlog_warn("ioctl open error : %s .\n",safe_strerror(errno));
		return -1;
	}
			
	ret = ioctl(fd, RPA_IOC_UNREG_IF, &rpa_info);
	if(ret < 0)
	{			
		zlog_warn("ioctl error : %s .\n",safe_strerror(errno));
		close(fd);
		return -1;
	}
	close(fd);
	return 0;


}
コード例 #23
0
ファイル: ioctl_solaris.c プロジェクト: Addision/LVS
/* Unset interface's flag. */
int
if_unset_flags (struct interface *ifp, uint64_t flags)
{
  int ret;
  struct lifreq lifreq;

  lifreq_set_name (&lifreq, ifp->name);

  lifreq.lifr_flags = ifp->flags;
  lifreq.lifr_flags &= ~flags;

  if (ifp->flags & IFF_IPV4)
    ret = AF_IOCTL (AF_INET, SIOCSLIFFLAGS, (caddr_t) & lifreq);
  else if (ifp->flags & IFF_IPV6)
    ret = AF_IOCTL (AF_INET6, SIOCSLIFFLAGS, (caddr_t) & lifreq);
  else
    ret = -1;

  if (ret < 0)
    zlog_info ("can't unset interface flags");
  else
    ret = 0;
  
  return ret;
}
コード例 #24
0
ファイル: snmp.c プロジェクト: IPInfusion/SDN-IP
/* Snmp OID Dump */
void
snmp_oid_dump (struct lib_globals *zg, char *prefix,
               oid *oid, size_t oid_len)
{
  s_int32_t i;
  s_int32_t first = 1;
  int j; 
  char buf[MAX_OID_LEN * 3];
  int offset = 0;

  buf[0] = '\0';
  j = MAX_OID_LEN * 3;

  for (i = 0; i < oid_len; i++)
    {
      pal_snprintf (buf + offset, j - offset, 
                    "%s%2d", first ? "" : ".", (s_int32_t) oid[i]);
      if (first)
        offset += 2;
      else
        offset += 3;
      first = 0;
    }
  buf[offset] = '\0';
  zlog_info (zg, "%s: %s", prefix, buf);
}
コード例 #25
0
ファイル: ospf6_asbr.c プロジェクト: edderick/quagga_zOSPF
void
ospf6_asbr_lsentry_add (struct ospf6_route *asbr_entry)
{
    struct ospf6_lsa *lsa;
    u_int16_t type;
    u_int32_t router;

    if (! CHECK_FLAG (asbr_entry->flag, OSPF6_ROUTE_BEST))
    {
        char buf[16];
        inet_ntop (AF_INET, &ADV_ROUTER_IN_PREFIX (&asbr_entry->prefix),
                   buf, sizeof (buf));
        zlog_info ("ignore non-best path: lsentry %s add", buf);
        return;
    }

    type = htons (OSPF6_LSTYPE_AS_EXTERNAL);
    router = ospf6_linkstate_prefix_adv_router (&asbr_entry->prefix);
    for (lsa = ospf6_lsdb_type_router_head (type, router, ospf6->lsdb); lsa;
            lsa = ospf6_lsdb_type_router_next (type, router, lsa))
    {
        if (! OSPF6_LSA_IS_MAXAGE (lsa))
            ospf6_asbr_lsa_add (lsa);
    }
}
コード例 #26
0
ファイル: event.c プロジェクト: mailhonor/libzc
int timer_cb(ZTIMER * zt, void *ctx)
{
	zlog_info("now exit!");
	exit(1);

	return 0;
}
コード例 #27
0
int
exchange_done (struct thread *thread)
{
  struct ospf6_neighbor *on;

  on = (struct ospf6_neighbor *) THREAD_ARG (thread);
  assert (on);

  if (on->state != OSPF6_NEIGHBOR_EXCHANGE)
    return 0;

  if (IS_OSPF6_DEBUG_NEIGHBOR (EVENT))
    zlog_info ("Neighbor Event %s: *ExchangeDone*", on->name);

  THREAD_OFF (on->thread_send_dbdesc);
  ospf6_lsdb_remove_all (on->dbdesc_list);

/* XXX
  thread_add_timer (master, ospf6_neighbor_last_dbdesc_release, on,
                    on->ospf6_if->dead_interval);
*/

  if (on->request_list->count == 0)
    ospf6_neighbor_state_change (OSPF6_NEIGHBOR_FULL, on);
  else
    ospf6_neighbor_state_change (OSPF6_NEIGHBOR_LOADING, on);

  return 0;
}
コード例 #28
0
ファイル: dfv_repo.c プロジェクト: Cai900205/test
ssize_t dfv_repo_get_diskfree(struct dfv_repo* repo)
{
    ssize_t df = -1;
    
    assert(repo);

    struct statfs sfs;
#if 1
    int i;
    char pathname[SPK_MAX_PATHNAME];
    df =0;
    char mnt_path[SPK_MAX_PATHNAME];
    strcpy(mnt_path, repo->mnt_path);
    for(i=0; i<repo->dev_num; i++) {
        sprintf(pathname, "/%s/%s/%s", DFV_PREFIX_PATH, mnt_path, DFV_POSTFIX_PATH);
        if(!statfs(pathname, &sfs)) {
            df += sfs.f_bavail*sfs.f_bsize;
        }
        mnt_path[2]++;
    }

#else
    if(!statfs(repo->root_path, &sfs)) {
        df = sfs.f_bavail*sfs.f_bsize;
    }

#endif
    zlog_info(dfv_zc, "get repo diskfree: path=%s, df=%ld",
                 repo->root_path, df);
    return (df);
}
コード例 #29
0
int
oneway_received (struct thread *thread)
{
  struct ospf6_neighbor *on;
  struct ospf6_lsa *lsa;

  on = (struct ospf6_neighbor *) THREAD_ARG (thread);
  assert (on);

  if (on->state < OSPF6_NEIGHBOR_TWOWAY)
    return 0;

  if (IS_OSPF6_DEBUG_NEIGHBOR (EVENT))
    zlog_info ("Neighbor Event %s: *1Way-Received*", on->name);

  ospf6_neighbor_state_change (OSPF6_NEIGHBOR_INIT, on);
  thread_add_event (master, neighbor_change, on->ospf6_if, 0);

  ospf6_lsdb_remove_all (on->summary_list);
  ospf6_lsdb_remove_all (on->request_list);
  for (lsa = ospf6_lsdb_head (on->retrans_list); lsa;
       lsa = ospf6_lsdb_next (lsa))
    {
      ospf6_decrement_retrans_count (lsa);
      ospf6_lsdb_remove (lsa, on->retrans_list);
    }

  THREAD_OFF (on->thread_send_dbdesc);
  THREAD_OFF (on->thread_send_lsreq);
  THREAD_OFF (on->thread_send_lsupdate);
  THREAD_OFF (on->thread_send_lsack);

  return 0;
}
コード例 #30
0
ファイル: http_engine.c プロジェクト: niks3089/nixia
void
http_engine_stop()
{
    int i;

    if (!g_http_engine) {
        return;
    }

    zlog_info(log_get_cat_http(), "Stopping HTTP engine");

    /* Stop all the workers */
    pthread_mutex_lock(&g_http_engine->lock);

    if (g_http_engine->workers_running) {
        for (i = 0; i < g_http_engine->total_workers; i++) {
            if(g_http_engine->workers[i].worker &&
                    g_http_engine->workers[i].user_event) {
                event_active(g_http_engine->workers[i].user_event,
                        EV_READ|EV_WRITE, 1);
            }
        }
    }
    pthread_mutex_unlock(&g_http_engine->lock);

    /* Wait here for the threads to stop */
    http_engine_wait_for_completion();

    /* Save the test results */
    http_engine_save_test_results();

}