• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ MPLS_ASSERT函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: mpls_label_struct2ldp_attr

void mpls_label_struct2ldp_attr(mpls_label_struct * l, ldp_attr * a)
{
  switch (l->type) {
    case MPLS_LABEL_TYPE_GENERIC:
      a->genLblTlvExists = 1;
      a->atmLblTlvExists = 0;
      a->frLblTlvExists = 0;
      a->genLblTlv.label = l->u.gen;
      break;
    case MPLS_LABEL_TYPE_ATM:
      a->genLblTlvExists = 0;
      a->atmLblTlvExists = 1;
      a->frLblTlvExists = 0;
      a->atmLblTlv.flags.flags.vpi = l->u.atm.vpi;
      a->atmLblTlv.vci = l->u.atm.vci;
    case MPLS_LABEL_TYPE_FR:
      a->genLblTlvExists = 0;
      a->atmLblTlvExists = 0;
      a->frLblTlvExists = 1;
      a->frLblTlv.flags.flags.len = l->u.fr.len;
      a->frLblTlv.flags.flags.dlci = l->u.fr.dlci;
    default:
      MPLS_ASSERT(0);
  }
}
开发者ID:paban,项目名称:my-source,代码行数:25,代码来源:ldp_attr.c


示例17: ldp_attr_delete_upstream

void ldp_attr_delete_upstream(ldp_global * g, ldp_session * s, ldp_attr * a)
{
  ldp_fec *fnode = NULL;
  ldp_fs *fs = NULL;

  MPLS_ASSERT(a->in_tree == MPLS_BOOL_TRUE);

  MPLS_REFCNT_HOLD(a);

  /* find the fec node in the tree */
  if ((fnode = _ldp_attr_get_fec(g, a, MPLS_BOOL_FALSE))) {
    /* find the upstream fs for this session, on the fec */
    if ((fs = _ldp_fec_find_fs_us(fnode, s, MPLS_BOOL_FALSE))) {
      /* remove this attr from the fs, if this was the last
       * attr on the fs, then remove the fs from the fec node
       */
      if (_ldp_fs_del_attr(g, fs, a) == MPLS_BOOL_TRUE) {
        _ldp_fec_del_fs_us(fnode, fs);
      }
    }
  }

  ldp_attr_del_session(g, a);
  ldp_attr_del_fec(g, a);

  a->in_tree = MPLS_BOOL_FALSE;
  MPLS_REFCNT_RELEASE2(g, a, ldp_attr_delete);
}
开发者ID:paban,项目名称:my-source,代码行数:28,代码来源:ldp_attr.c


示例18: ldp_mesg_hdr_get_lsraddr

void ldp_mesg_hdr_get_lsraddr(ldp_mesg * msg, mpls_inet_addr * lsraddr)
{
    MPLS_ASSERT(msg && lsraddr);

    lsraddr->type = MPLS_FAMILY_IPV4;
    lsraddr->u.ipv4 = msg->header.lsrAddress;
}
开发者ID:paban,项目名称:my-source,代码行数:7,代码来源:ldp_mesg.c


示例19: ldp_nexthop_add_outlabel2

void ldp_nexthop_add_outlabel2(ldp_nexthop * n, ldp_outlabel * o)
{
  MPLS_ASSERT(n && o);
  MPLS_REFCNT_HOLD(o);
  MPLS_LIST_ADD_HEAD(&n->outlabel_root, o, _nexthop, ldp_outlabel);
  memcpy(&o->info.nexthop, &n->info, sizeof(mpls_nexthop));
}
开发者ID:MichaelQQ,项目名称:Quagga-PE,代码行数:7,代码来源:ldp_nexthop.c


示例20: ldp_attr_delete

void ldp_attr_delete(ldp_global *g, ldp_attr * a)
{
  LDP_PRINT(g->user_data, "attr delete: %p", a);
  MPLS_REFCNT_ASSERT(a, 0);
  MPLS_ASSERT(a->in_tree == MPLS_BOOL_FALSE);
  _ldp_global_del_attr(g, a);
  mpls_free(a);
}
开发者ID:paban,项目名称:my-source,代码行数:8,代码来源:ldp_attr.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ MPL_ASSERT函数代码示例发布时间:2022-05-30
下一篇:
C++ MPI_Wtime函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap