当前位置: 首页>>代码示例>>C++>>正文


C++ MPLS_ASSERT函数代码示例

本文整理汇总了C++中MPLS_ASSERT函数的典型用法代码示例。如果您正苦于以下问题:C++ MPLS_ASSERT函数的具体用法?C++ MPLS_ASSERT怎么用?C++ MPLS_ASSERT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了MPLS_ASSERT函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: ldp_fec_remove

static void ldp_fec_remove(ldp_global *g, mpls_fec *fec)
{
  ldp_fec *f = NULL;
  uint32_t key;
  uint8_t len;

  MPLS_ASSERT(g && fec);
  LDP_ENTER(g->user_data, "ldp_fec_remove");

  switch(fec->type) {
    case MPLS_FEC_PREFIX:
      key = fec->u.prefix.network.u.ipv4;
      len = fec->u.prefix.length;
      break;
    case MPLS_FEC_HOST:
      key = fec->u.host.u.ipv4;
      len = 32;
      break;
    case MPLS_FEC_L2CC:
      /* they had better remove it from the global list */
      LDP_EXIT(g->user_data, "ldp_fec_remove");
      return;
    case MPLS_PW_ID_FEC: //testing
      len=32;
      break;
    default:
      MPLS_ASSERT(0);
  }

  mpls_tree_remove(g->fec_tree, key, len, (void **)&f);

  MPLS_ASSERT(f);

  LDP_EXIT(g->user_data, "ldp_fec_remove");
}
开发者ID:MichaelQQ,项目名称:Quagga-PE,代码行数:35,代码来源:ldp_fec.c

示例2: ldp_inlabel_add_outlabel

mpls_return_enum ldp_inlabel_add_outlabel(ldp_global *g, ldp_inlabel *i,
  ldp_outlabel *o) {
  mpls_return_enum result;

  MPLS_ASSERT(i && o);
  MPLS_ASSERT(i->outlabel == NULL);

#if MPLS_USE_LSR
  {
    lsr_xconnect xcon;
    xcon.insegment_index = i->info.handle;
    xcon.outsegment_index = o->info.handle;
    xcon.info.owner = MPLS_OWNER_LDP;
    result = lsr_cfg_xconnect_set2(g->lsr_handle, &xcon, LSR_CFG_ADD|
      LSR_XCONNECT_CFG_OUTSEGMENT|LSR_XCONNECT_CFG_INSEGMENT|
      LSR_XCONNECT_CFG_LSPID|LSR_XCONNECT_CFG_OWNER);
  }
#else
  result = mpls_mpls_xconnect_add(g->mpls_handle, &i->info, &o->info);
#endif
  if (result == MPLS_SUCCESS) {
    MPLS_REFCNT_HOLD(o);
    i->outlabel = o;
    _ldp_outlabel_add_inlabel(o, i);
  }
  return result;
}
开发者ID:MichaelQQ,项目名称:Quagga-PE,代码行数:27,代码来源:ldp_inlabel.c

示例3: ldp_mesg_send_udp

mpls_return_enum ldp_mesg_send_udp(ldp_global * g, ldp_entity * e,
                                   ldp_mesg * msg)
{
    ldp_buf *buf = NULL;
    mpls_dest *dest = NULL;
    int32_t result = 0;
    uint16_t label_space = 0;

    MPLS_ASSERT(e);

    switch (e->entity_type) {
    case LDP_DIRECT:
        MPLS_ASSERT(e->p.iff != NULL);
        if (mpls_socket_multicast_if_tx(g->socket_handle, g->hello_socket,
                                        e->p.iff) == MPLS_FAILURE) {
            LDP_PRINT(g->user_data, "ldp_mesg_send_udp: muticast tx error(%d)\n",
                      mpls_socket_get_errno(g->socket_handle, g->hello_socket));
            return MPLS_FAILURE;
        }
        dest = &e->p.iff->dest;
        buf = e->p.iff->tx_buffer;
        label_space = e->p.iff->label_space;
        break;
    case LDP_INDIRECT:
        MPLS_ASSERT(e->p.peer != NULL);
        dest = &e->p.peer->dest;
        buf = e->p.peer->tx_buffer;
        label_space = e->p.peer->label_space;
        break;
    default:
        MPLS_ASSERT(0);
    }
    result =
        ldp_encode_one_mesg(g, g->lsr_identifier.u.ipv4, label_space, buf, msg);

    if (result <= 0)
        return MPLS_FAILURE;

    e->mesg_tx++;

    result = mpls_socket_udp_sendto(g->socket_handle, g->hello_socket,
                                    buf->buffer, buf->size, dest);

    switch (e->entity_type) {
    case LDP_DIRECT:
        mpls_socket_multicast_if_tx(g->socket_handle, g->hello_socket, NULL);
        break;
    case LDP_INDIRECT:
        break;
    default:
        MPLS_ASSERT(0);
    }

    if (result <= 0) {
        LDP_PRINT(g->user_data, "sendto failed(%d)\n", result);
        perror("sendto");
        return MPLS_FAILURE;
    }
    return MPLS_SUCCESS;
}
开发者ID:paban,项目名称:my-source,代码行数:60,代码来源:ldp_mesg.c

示例4: mpls_socket_writelist_add

mpls_return_enum mpls_socket_writelist_add(mpls_socket_mgr_handle handle,
  mpls_socket_handle socket, void *extra, mpls_socket_enum type)
{
  socket->type = type;
  socket->extra = extra;
  MPLS_ASSERT(socket && (socket->fd > -1));
  socket->write = thread_add_write(master,mplsd_write,socket,socket->fd);
  MPLS_ASSERT(socket->write);
  return MPLS_SUCCESS;
}
开发者ID:MichaelQQ,项目名称:Quagga-PE,代码行数:10,代码来源:impl_socket.c

示例5: ldp_adj_startup

mpls_return_enum ldp_adj_startup(ldp_global * g, ldp_adj * a, int request)
{
    ldp_entity *e;

    MPLS_ASSERT(a && (e = a->entity));
    /* with recent changes to when the session gets created I think this
     * assert is not longer valid - jleu 2003-02-20
    MPLS_ASSERT(!a->session);
     */
    MPLS_ASSERT(a->state != LDP_NONE);

    LDP_ENTER(g->user_data, "ldp_adj_startup");

    /* ldp-11 3.5.2. Hello Message */
    if (e->hellotime_timer != 0xFFFF) {
        MPLS_REFCNT_HOLD(a);
        a->hellotime_recv_timer = mpls_timer_create(g->timer_handle, MPLS_UNIT_SEC,
                                  e->hellotime_timer, (void *)a, g, ldp_hello_timeout_callback);

        if (mpls_timer_handle_verify(g->timer_handle, a->hellotime_recv_timer) ==
                MPLS_BOOL_FALSE) {
            MPLS_REFCNT_RELEASE(a, ldp_adj_delete);
            goto ldp_adj_startup_error;
        }
    }

    if (request && mpls_timer_handle_verify(g->timer_handle,
                                            e->p.peer->hellotime_send_timer) == MPLS_BOOL_FALSE) {
        /* request is ONLY specific with indirect adj */
        ldp_hello_send(g, e);
    }

    a->state = MPLS_OPER_UP;

    if (e->hellotime_timer != 0xFFFF) {
        mpls_timer_start(g->timer_handle, a->hellotime_recv_timer,
                         MPLS_TIMER_ONESHOT);
    }

    LDP_EXIT(g->user_data, "ldp_adj_startup");

    return MPLS_SUCCESS;

ldp_adj_startup_error:

    LDP_EXIT(g->user_data, "ldp_adj_startup: error");

    return MPLS_FAILURE;
}
开发者ID:antonrogov,项目名称:freebsd-ldpd,代码行数:49,代码来源:ldp_adj.c

示例6: ldp_fec_find_nexthop_index

mpls_return_enum ldp_fec_find_nexthop_index(ldp_fec *f, int index,
  ldp_nexthop **n)
{
  ldp_nexthop *nh = NULL;

  MPLS_ASSERT(f);

  if (index > 0) {

    /* because we sort our inserts by index, this lets us know
       if we've "walked" past the end of the list */

    nh = MPLS_LIST_TAIL(&f->nh_root);
    if (!nh || nh->index < index) {
      *n = NULL;
      return MPLS_END_OF_LIST;
    }

    nh = MPLS_LIST_HEAD(&f->nh_root);
    do {
      if (nh->index == index) {
        *n = nh;
        return MPLS_SUCCESS;
      }
    } while((nh = MPLS_LIST_NEXT(&f->nh_root, nh, _fec)));
  }
  *n = NULL;
  return MPLS_FAILURE;
}
开发者ID:MichaelQQ,项目名称:Quagga-PE,代码行数:29,代码来源:ldp_fec.c

示例7: ldp_nexthop_del_outlabel2

void ldp_nexthop_del_outlabel2(ldp_global *g, ldp_nexthop * n, ldp_outlabel * o)
{
  MPLS_ASSERT(n && o);
  MPLS_LIST_REMOVE(&n->outlabel_root, o, _nexthop);
  ldp_outlabel_del_nexthop2(g, o);
  MPLS_REFCNT_RELEASE(o, ldp_outlabel_delete);
}
开发者ID:MichaelQQ,项目名称:Quagga-PE,代码行数:7,代码来源:ldp_nexthop.c

示例8: ldp_nexthop_add_if

void ldp_nexthop_add_if(ldp_nexthop * nh, ldp_if * i)
{
  MPLS_ASSERT(nh && i);
  MPLS_REFCNT_HOLD(i);
  nh->info.if_handle = i->handle;
  nh->iff = i;
}
开发者ID:MichaelQQ,项目名称:Quagga-PE,代码行数:7,代码来源:ldp_nexthop.c

示例9: _ldp_inlabel_del_attr

void _ldp_inlabel_del_attr(ldp_inlabel * i, ldp_attr * a)
{
  MPLS_ASSERT(i && a);
  mpls_link_list_remove_data(&i->attr_root, a);
  MPLS_REFCNT_RELEASE(a, ldp_attr_delete);
  i->reuse_count--;
}
开发者ID:MichaelQQ,项目名称:Quagga-PE,代码行数:7,代码来源:ldp_inlabel.c

示例10: ldp_mesg_send_tcp

mpls_return_enum ldp_mesg_send_tcp(ldp_global * g, ldp_session * s,
                                   ldp_mesg * msg)
{
    int32_t result = 0;

    MPLS_ASSERT(s);

    result = ldp_encode_one_mesg(g, g->lsr_identifier.u.ipv4,
                                 s->cfg_label_space, s->tx_buffer, msg);

    if (result <= 0)
        return MPLS_FAILURE;

    s->mesg_tx++;

    result = mpls_socket_tcp_write(g->socket_handle, s->socket,
                                   s->tx_buffer->buffer, s->tx_buffer->size);

    if (result <= 0) {
        LDP_PRINT(g->user_data, "send failed(%d)\n", result);
        perror("send");
        return MPLS_FAILURE;
    }
    return MPLS_SUCCESS;
}
开发者ID:paban,项目名称:my-source,代码行数:25,代码来源:ldp_mesg.c

示例11: ldp_adj_del_session

void ldp_adj_del_session(ldp_adj * a, ldp_session * s)
{
    MPLS_ASSERT(a && s);
    _ldp_session_del_adj(s, a);
    MPLS_REFCNT_RELEASE(s, ldp_session_delete);
    a->session = NULL;
}
开发者ID:antonrogov,项目名称:freebsd-ldpd,代码行数:7,代码来源:ldp_adj.c

示例12: mpls_label_struct_compare

int mpls_label_struct_compare(struct mpls_label_struct* l1,
		struct mpls_label_struct* l2) {
  if (l1->type != l2->type) {
    return 1;
  }
  switch(l1->type) {
    case MPLS_LABEL_TYPE_GENERIC:
      if (l1->u.gen != l2->u.gen) {
	return (l1->u.gen > l2->u.gen) ? 1 : -1;
      }
      break;
    case MPLS_LABEL_TYPE_ATM:
      if (l1->u.atm.vpi != l2->u.atm.vpi) {
	return (l1->u.atm.vpi > l2->u.atm.vpi) ? 1 : -1;
      }
      if (l1->u.atm.vci != l2->u.atm.vci) {
	return (l1->u.atm.vci > l2->u.atm.vci) ? 1 : -1;
      }
      break;
    case MPLS_LABEL_TYPE_FR:
      if (l1->u.fr.len != l2->u.fr.len) {
	return (l1->u.fr.dlci > l2->u.fr.dlci) ? 1 : -1;
      }
      if (l1->u.fr.dlci != l2->u.fr.dlci) {
	return (l1->u.fr.len > l2->u.fr.len) ? 1 : -1;
      }
      break;
    default:
      MPLS_ASSERT(0);
  }
  return 0;
}
开发者ID:MichaelQQ,项目名称:Quagga-PE,代码行数:32,代码来源:mpls_compare.c

示例13: switch

ldp_fec *ldp_fec_find(ldp_global *g, mpls_fec *fec)
{
  ldp_fec *f = NULL;
  uint32_t key;
  uint8_t len;
  
  switch(fec->type) {
    case MPLS_FEC_PREFIX:
      key = fec->u.prefix.network.u.ipv4;
      len = fec->u.prefix.length;
      break;
    case MPLS_FEC_HOST:
      key = fec->u.host.u.ipv4;
      len = 32;
      break;
    case MPLS_FEC_L2CC:
      if (ldp_global_find_fec(g, fec, &f) == MPLS_SUCCESS) {
	return f;
      }
      return NULL;
    case MPLS_PW_ID_FEC://testing
      len=32;
      break;
    default:
      MPLS_ASSERT(0);
  }

  if (mpls_tree_get(g->fec_tree, key, len, (void **)&f) != MPLS_SUCCESS) {
    return NULL;
  }
  return f;
}
开发者ID:MichaelQQ,项目名称:Quagga-PE,代码行数:32,代码来源:ldp_fec.c

示例14: ldp_attr_del_fec

void ldp_attr_del_fec(ldp_global *g, ldp_attr *a) {
  MPLS_ASSERT(a);
  if (a->fec) {
    MPLS_REFCNT_RELEASE2(g, a->fec, ldp_fec_delete);
    a->fec = NULL;
  }
}
开发者ID:paban,项目名称:my-source,代码行数:7,代码来源:ldp_attr.c

示例15: mpls_fec_compare

int mpls_fec_compare(struct mpls_fec* f1, struct mpls_fec* f2) {
  int retval;

  if (f1->type != f2->type) {
    return 1;
  }

  switch(f1->type) {
    case MPLS_FEC_PREFIX:
      if ((retval = mpls_inet_addr_compare(&f1->u.prefix.network,
        &f2->u.prefix.network))) {
        return retval;
      }
      if (f1->u.prefix.length > f2->u.prefix.length) {
	return (f1->u.prefix.length != f2->u.prefix.length) ? 1 : -1;
      }
      break;
    case MPLS_FEC_HOST:
      return mpls_inet_addr_compare(&f1->u.host, &f2->u.host);
    case MPLS_FEC_L2CC:
      if (f1->u.l2cc.connection_id != f2->u.l2cc.connection_id) {
	return (f1->u.l2cc.connection_id>f2->u.l2cc.connection_id) ? 1 : -1;
      }
      if (f1->u.l2cc.group_id != f2->u.l2cc.group_id) {
	return (f1->u.l2cc.group_id > f2->u.l2cc.group_id) ? 1 : -1;
      }
      if (f1->u.l2cc.type != f2->u.l2cc.type) {
	return 1;
      }
      break;
    default:
      MPLS_ASSERT(0);
  }
  return 0;
}
开发者ID:MichaelQQ,项目名称:Quagga-PE,代码行数:35,代码来源:mpls_compare.c


注:本文中的MPLS_ASSERT函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。