这篇教程C++ DN_SKB_CB函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中DN_SKB_CB函数的典型用法代码示例。如果您正苦于以下问题:C++ DN_SKB_CB函数的具体用法?C++ DN_SKB_CB怎么用?C++ DN_SKB_CB使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了DN_SKB_CB函数的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: dn_nsp_otherdatastatic void dn_nsp_otherdata(struct sock *sk, struct sk_buff *skb){ struct dn_scp *scp = DN_SK(sk); unsigned short segnum; struct dn_skb_cb *cb = DN_SKB_CB(skb); int queued = 0; if (skb->len < 2) goto out; cb->segnum = segnum = le16_to_cpu(*(__le16 *)skb->data); skb_pull(skb, 2); if (seq_next(scp->numoth_rcv, segnum)) { if (dn_queue_skb(sk, skb, SIGURG, &scp->other_receive_queue) == 0) { seq_add(&scp->numoth_rcv, 1); scp->other_report = 0; queued = 1; } } dn_nsp_send_oth_ack(sk);out: if (!queued) kfree_skb(skb);}
开发者ID:AlexShiLucky,项目名称:linux,代码行数:27,
示例2: dn_nsp_no_socketstatic int dn_nsp_no_socket(struct sk_buff *skb, unsigned short reason){ struct dn_skb_cb *cb = DN_SKB_CB(skb); int ret = NET_RX_DROP; /* Must not reply to returned packets */ if (cb->rt_flags & DN_RT_F_RTS) goto out; if ((reason != NSP_REASON_OK) && ((cb->nsp_flags & 0x0c) == 0x08)) { switch (cb->nsp_flags & 0x70) { case 0x10: case 0x60: /* (Retransmitted) Connect Init */ dn_nsp_return_disc(skb, NSP_DISCINIT, reason); ret = NET_RX_SUCCESS; break; case 0x20: /* Connect Confirm */ dn_nsp_return_disc(skb, NSP_DISCCONF, reason); ret = NET_RX_SUCCESS; break; } }out: kfree_skb(skb); return ret;}
开发者ID:AlexShiLucky,项目名称:linux,代码行数:27,
示例3: dn_nsp_datastatic void dn_nsp_data(struct sock *sk, struct sk_buff *skb){ int queued = 0; unsigned short segnum; struct dn_skb_cb *cb = DN_SKB_CB(skb); struct dn_scp *scp = DN_SK(sk); if (skb->len < 2) goto out; cb->segnum = segnum = le16_to_cpu(*(__le16 *)skb->data); skb_pull(skb, 2); if (seq_next(scp->numdat_rcv, segnum)) { if (dn_queue_skb(sk, skb, SIGIO, &sk->sk_receive_queue) == 0) { seq_add(&scp->numdat_rcv, 1); queued = 1; } if ((scp->flowloc_sw == DN_SEND) && dn_congested(sk)) { scp->flowloc_sw = DN_DONTSEND; dn_nsp_send_link(sk, DN_DONTSEND, 0); } } dn_nsp_send_data_ack(sk);out: if (!queued) kfree_skb(skb);}
开发者ID:AlexShiLucky,项目名称:linux,代码行数:30,
示例4: dn_nsp_queue_xmitvoid dn_nsp_queue_xmit(struct sock *sk, struct sk_buff *skb, gfp_t gfp, int oth){ struct dn_scp *scp = DN_SK(sk); struct dn_skb_cb *cb = DN_SKB_CB(skb); unsigned long t = ((scp->nsp_srtt >> 2) + scp->nsp_rttvar) >> 1; cb->xmit_count = 0; dn_nsp_mk_data_header(sk, skb, oth); /* * Slow start: If we have been idle for more than * one RTT, then reset window to min size. */ if ((jiffies - scp->stamp) > t) scp->snd_window = NSP_MIN_WINDOW; if (oth) skb_queue_tail(&scp->other_xmit_queue, skb); else skb_queue_tail(&scp->data_xmit_queue, skb); if (scp->flowrem_sw != DN_SEND) return; dn_nsp_clone_and_send(skb, gfp);}
开发者ID:flwh,项目名称:Alcatel_OT_985_kernel,代码行数:27,
示例5: dn_log_martianstatic void dn_log_martian(struct sk_buff *skb, const char *msg){ if (decnet_log_martians && net_ratelimit()) { char *devname = skb->dev ? skb->dev->name : "???"; struct dn_skb_cb *cb = DN_SKB_CB(skb); printk(KERN_INFO "DECnet: Martian packet (%s) dev=%s src=0x%04hx dst=0x%04hx srcport=0x%04hx dstport=0x%04hx/n", msg, devname, dn_ntohs(cb->src), dn_ntohs(cb->dst), dn_ntohs(cb->src_port), dn_ntohs(cb->dst_port)); }}
开发者ID:Mr-Aloof,项目名称:wl500g,代码行数:8,
示例6: dn_nsp_return_discvoid dn_nsp_return_disc(struct sk_buff *skb, unsigned char msgflg, unsigned short reason){ struct dn_skb_cb *cb = DN_SKB_CB(skb); int ddl = 0; gfp_t gfp = GFP_ATOMIC; dn_nsp_do_disc(NULL, msgflg, reason, gfp, skb_dst(skb), ddl, NULL, cb->src_port, cb->dst_port);}
开发者ID:flwh,项目名称:Alcatel_OT_985_kernel,代码行数:10,
示例7: dn_nsp_disc_initstatic void dn_nsp_disc_init(struct sock *sk, struct sk_buff *skb){ struct dn_scp *scp = DN_SK(sk); struct dn_skb_cb *cb = DN_SKB_CB(skb); unsigned short reason; if (skb->len < 2) goto out; reason = dn_ntohs(*(__u16 *)skb->data); skb_pull(skb, 2); scp->discdata_in.opt_status = reason; scp->discdata_in.opt_optl = 0; memset(scp->discdata_in.opt_data, 0, 16); if (skb->len > 0) { unsigned char dlen = *skb->data; if ((dlen <= 16) && (dlen <= skb->len)) { scp->discdata_in.opt_optl = dlen; memcpy(scp->discdata_in.opt_data, skb->data + 1, dlen); } } scp->addrrem = cb->src_port; sk->state = TCP_CLOSE; switch(scp->state) { case DN_CI: case DN_CD: scp->state = DN_RJ; break; case DN_RUN: sk->shutdown |= SHUTDOWN_MASK; scp->state = DN_DN; break; case DN_DI: scp->state = DN_DIC; break; } if (!sk->dead) { if (sk->socket->state != SS_UNCONNECTED) sk->socket->state = SS_DISCONNECTING; sk->state_change(sk); } dn_nsp_send_disc(sk, NSP_DISCCONF, NSP_REASON_DC, GFP_ATOMIC); scp->persist_fxn = dn_destroy_timer; scp->persist = dn_nsp_persist(sk);out: kfree_skb(skb);}
开发者ID:iwangv,项目名称:edimax-br-6528n,代码行数:54,
示例8: dn_log_martianstatic void dn_log_martian(struct sk_buff *skb, const char *msg){ if (decnet_log_martians) { char *devname = skb->dev ? skb->dev->name : "???"; struct dn_skb_cb *cb = DN_SKB_CB(skb); net_info_ratelimited("DECnet: Martian packet (%s) dev=%s src=0x%04hx dst=0x%04hx srcport=0x%04hx dstport=0x%04hx/n", msg, devname, le16_to_cpu(cb->src), le16_to_cpu(cb->dst), le16_to_cpu(cb->src_port), le16_to_cpu(cb->dst_port)); }}
开发者ID:AlexShiLucky,项目名称:linux,代码行数:13,
示例9: dn_nsp_clone_and_sendstatic inline unsigned dn_nsp_clone_and_send(struct sk_buff *skb, gfp_t gfp){ struct dn_skb_cb *cb = DN_SKB_CB(skb); struct sk_buff *skb2; int ret = 0; if ((skb2 = skb_clone(skb, gfp)) != NULL) { ret = cb->xmit_count; cb->xmit_count++; cb->stamp = jiffies; skb2->sk = skb->sk; dn_nsp_send(skb2); } return ret;}
开发者ID:flwh,项目名称:Alcatel_OT_985_kernel,代码行数:17,
示例10: DN_SKstatic __le16 *dn_nsp_mk_data_header(struct sock *sk, struct sk_buff *skb, int oth){ struct dn_scp *scp = DN_SK(sk); struct dn_skb_cb *cb = DN_SKB_CB(skb); __le16 *ptr = dn_mk_ack_header(sk, skb, cb->nsp_flags, 11, oth); if (unlikely(oth)) { cb->segnum = scp->numoth; seq_add(&scp->numoth, 1); } else { cb->segnum = scp->numdat; seq_add(&scp->numdat, 1); } *(ptr++) = cpu_to_le16(cb->segnum); return ptr;}
开发者ID:flwh,项目名称:Alcatel_OT_985_kernel,代码行数:17,
示例11: dn_long_outputstatic int dn_long_output(struct sk_buff *skb){ struct dst_entry *dst = skb->dst; struct neighbour *neigh = dst->neighbour; struct net_device *dev = neigh->dev; int headroom = dev->hard_header_len + sizeof(struct dn_long_packet) + 3; unsigned char *data; struct dn_long_packet *lp; struct dn_skb_cb *cb = DN_SKB_CB(skb); if (skb_headroom(skb) < headroom) { struct sk_buff *skb2 = skb_realloc_headroom(skb, headroom); if (skb2 == NULL) { if (net_ratelimit()) printk(KERN_CRIT "dn_long_output: no memory/n"); kfree_skb(skb); return -ENOBUFS; } kfree_skb(skb); skb = skb2; if (net_ratelimit()) printk(KERN_INFO "dn_long_output: Increasing headroom/n"); } data = skb_push(skb, sizeof(struct dn_long_packet) + 3); lp = (struct dn_long_packet *)(data+3); *((unsigned short *)data) = dn_htons(skb->len - 2); *(data + 2) = 1 | DN_RT_F_PF; /* Padding */ lp->msgflg = DN_RT_PKT_LONG|(cb->rt_flags&(DN_RT_F_IE|DN_RT_F_RQR|DN_RT_F_RTS)); lp->d_area = lp->d_subarea = 0; dn_dn2eth(lp->d_id, dn_ntohs(cb->dst)); lp->s_area = lp->s_subarea = 0; dn_dn2eth(lp->s_id, dn_ntohs(cb->src)); lp->nl2 = 0; lp->visit_ct = cb->hops & 0x3f; lp->s_class = 0; lp->pt = 0; skb->nh.raw = skb->data; return NF_HOOK(PF_DECnet, NF_DN_POST_ROUTING, skb, NULL, neigh->dev, dn_neigh_output_packet);}
开发者ID:iPodLinux,项目名称:linux-2.6.7-ipod,代码行数:45,
示例12: dn_nsp_conn_confstatic void dn_nsp_conn_conf(struct sock *sk, struct sk_buff *skb){ struct dn_skb_cb *cb = DN_SKB_CB(skb); struct dn_scp *scp = DN_SK(sk); unsigned char *ptr; if (skb->len < 4) goto out; ptr = skb->data; cb->services = *ptr++; cb->info = *ptr++; cb->segsize = le16_to_cpu(*(__le16 *)ptr); if ((scp->state == DN_CI) || (scp->state == DN_CD)) { scp->persist = 0; scp->addrrem = cb->src_port; sk->sk_state = TCP_ESTABLISHED; scp->state = DN_RUN; scp->services_rem = cb->services; scp->info_rem = cb->info; scp->segsize_rem = cb->segsize; if ((scp->services_rem & NSP_FC_MASK) == NSP_FC_NONE) scp->max_window = decnet_no_fc_max_cwnd; if (skb->len > 0) { u16 dlen = *skb->data; if ((dlen <= 16) && (dlen <= skb->len)) { scp->conndata_in.opt_optl = cpu_to_le16(dlen); skb_copy_from_linear_data_offset(skb, 1, scp->conndata_in.opt_data, dlen); } } dn_nsp_send_link(sk, DN_NOCHANGE, 0); if (!sock_flag(sk, SOCK_DEAD)) sk->sk_state_change(sk); }out: kfree_skb(skb);}
开发者ID:AlexShiLucky,项目名称:linux,代码行数:42,
示例13: dn_nsp_conn_confstatic void dn_nsp_conn_conf(struct sock *sk, struct sk_buff *skb){ struct dn_skb_cb *cb = DN_SKB_CB(skb); struct dn_scp *scp = DN_SK(sk); unsigned char *ptr; if (skb->len < 4) goto out; ptr = skb->data; cb->services = *ptr++; cb->info = *ptr++; cb->segsize = dn_ntohs(*(__u16 *)ptr); if ((scp->state == DN_CI) || (scp->state == DN_CD)) { scp->persist = 0; scp->addrrem = cb->src_port; sk->state = TCP_ESTABLISHED; scp->state = DN_RUN; scp->services_rem = cb->services; scp->info_rem = cb->info; scp->segsize_rem = cb->segsize; if ((scp->services_rem & NSP_FC_MASK) == NSP_FC_NONE) scp->max_window = decnet_no_fc_max_cwnd; if (skb->len > 0) { unsigned char dlen = *skb->data; if ((dlen <= 16) && (dlen <= skb->len)) { scp->conndata_in.opt_optl = dlen; memcpy(scp->conndata_in.opt_data, skb->data + 1, dlen); } } dn_nsp_send_link(sk, DN_NOCHANGE, 0); if (!sk->dead) sk->state_change(sk); }out: kfree_skb(skb);}
开发者ID:iwangv,项目名称:edimax-br-6528n,代码行数:41,
示例14: dn_nsp_send_linkvoid dn_nsp_send_link(struct sock *sk, unsigned char lsflags, char fcval){ struct dn_scp *scp = DN_SK(sk); struct sk_buff *skb; unsigned char *ptr; gfp_t gfp = GFP_ATOMIC; if ((skb = dn_alloc_skb(sk, DN_MAX_NSP_DATA_HEADER + 2, gfp)) == NULL) return; skb_reserve(skb, DN_MAX_NSP_DATA_HEADER); ptr = skb_put(skb, 2); DN_SKB_CB(skb)->nsp_flags = 0x10; *ptr++ = lsflags; *ptr = fcval; dn_nsp_queue_xmit(sk, skb, gfp, 1); scp->persist = dn_nsp_persist(sk); scp->persist_fxn = dn_nsp_xmit_timeout;}
开发者ID:flwh,项目名称:Alcatel_OT_985_kernel,代码行数:21,
示例15: dn_short_outputstatic int dn_short_output(struct sk_buff *skb){ struct dst_entry *dst = skb->dst; struct neighbour *neigh = dst->neighbour; struct net_device *dev = neigh->dev; int headroom = dev->hard_header_len + sizeof(struct dn_short_packet) + 2; struct dn_short_packet *sp; unsigned char *data; struct dn_skb_cb *cb = DN_SKB_CB(skb); if (skb_headroom(skb) < headroom) { struct sk_buff *skb2 = skb_realloc_headroom(skb, headroom); if (skb2 == NULL) { if (net_ratelimit()) printk(KERN_CRIT "dn_short_output: no memory/n"); kfree_skb(skb); return -ENOBUFS; } kfree_skb(skb); skb = skb2; if (net_ratelimit()) printk(KERN_INFO "dn_short_output: Increasing headroom/n"); } data = skb_push(skb, sizeof(struct dn_short_packet) + 2); *((unsigned short *)data) = dn_htons(skb->len - 2); sp = (struct dn_short_packet *)(data+2); sp->msgflg = DN_RT_PKT_SHORT|(cb->rt_flags&(DN_RT_F_RQR|DN_RT_F_RTS)); sp->dstnode = cb->dst; sp->srcnode = cb->src; sp->forward = cb->hops & 0x3f; skb->nh.raw = skb->data; return NF_HOOK(PF_DECnet, NF_DN_POST_ROUTING, skb, NULL, neigh->dev, dn_neigh_output_packet);}
开发者ID:iPodLinux,项目名称:linux-2.6.7-ipod,代码行数:38,
示例16: dn_nsp_send_conninitvoid dn_nsp_send_conninit(struct sock *sk, unsigned char msgflg){ struct dn_scp *scp = DN_SK(sk); struct nsp_conn_init_msg *msg; unsigned char aux; unsigned char menuver; struct dn_skb_cb *cb; unsigned char type = 1; gfp_t allocation = (msgflg == NSP_CI) ? sk->sk_allocation : GFP_ATOMIC; struct sk_buff *skb = dn_alloc_skb(sk, 200, allocation); if (!skb) return; cb = DN_SKB_CB(skb); msg = (struct nsp_conn_init_msg *)skb_put(skb,sizeof(*msg)); msg->msgflg = msgflg; msg->dstaddr = 0x0000; /* Remote Node will assign it*/ msg->srcaddr = scp->addrloc; msg->services = scp->services_loc; /* Requested flow control */ msg->info = scp->info_loc; /* Version Number */ msg->segsize = cpu_to_le16(scp->segsize_loc); /* Max segment size */ if (scp->peer.sdn_objnum) type = 0; skb_put(skb, dn_sockaddr2username(&scp->peer, skb_tail_pointer(skb), type)); skb_put(skb, dn_sockaddr2username(&scp->addr, skb_tail_pointer(skb), 2)); menuver = DN_MENUVER_ACC | DN_MENUVER_USR; if (scp->peer.sdn_flags & SDF_PROXY) menuver |= DN_MENUVER_PRX; if (scp->peer.sdn_flags & SDF_UICPROXY) menuver |= DN_MENUVER_UIC; *skb_put(skb, 1) = menuver; /* Menu Version */ aux = scp->accessdata.acc_userl; *skb_put(skb, 1) = aux; if (aux > 0) memcpy(skb_put(skb, aux), scp->accessdata.acc_user, aux); aux = scp->accessdata.acc_passl; *skb_put(skb, 1) = aux; if (aux > 0) memcpy(skb_put(skb, aux), scp->accessdata.acc_pass, aux); aux = scp->accessdata.acc_accl; *skb_put(skb, 1) = aux; if (aux > 0) memcpy(skb_put(skb, aux), scp->accessdata.acc_acc, aux); aux = (__u8)le16_to_cpu(scp->conndata_out.opt_optl); *skb_put(skb, 1) = aux; if (aux > 0) memcpy(skb_put(skb,aux), scp->conndata_out.opt_data, aux); scp->persist = dn_nsp_persist(sk); scp->persist_fxn = dn_nsp_retrans_conninit; cb->rt_flags = DN_RT_F_RQR; dn_nsp_send(skb);}
开发者ID:flwh,项目名称:Alcatel_OT_985_kernel,代码行数:68,
示例17: dn_nsp_check_xmit_queueint dn_nsp_check_xmit_queue(struct sock *sk, struct sk_buff *skb, struct sk_buff_head *q, unsigned short acknum){ struct dn_skb_cb *cb = DN_SKB_CB(skb); struct dn_scp *scp = DN_SK(sk); struct sk_buff *skb2, *n, *ack = NULL; int wakeup = 0; int try_retrans = 0; unsigned long reftime = cb->stamp; unsigned long pkttime; unsigned short xmit_count; unsigned short segnum; skb_queue_walk_safe(q, skb2, n) { struct dn_skb_cb *cb2 = DN_SKB_CB(skb2); if (dn_before_or_equal(cb2->segnum, acknum)) ack = skb2; /* printk(KERN_DEBUG "ack: %s %04x %04x/n", ack ? "ACK" : "SKIP", (int)cb2->segnum, (int)acknum); */ if (ack == NULL) continue; /* printk(KERN_DEBUG "check_xmit_queue: %04x, %d/n", acknum, cb2->xmit_count); */ /* Does _last_ packet acked have xmit_count > 1 */ try_retrans = 0; /* Remember to wake up the sending process */ wakeup = 1; /* Keep various statistics */ pkttime = cb2->stamp; xmit_count = cb2->xmit_count; segnum = cb2->segnum; /* Remove and drop ack'ed packet */ skb_unlink(ack, q); kfree_skb(ack); ack = NULL; /* * We don't expect to see acknowledgements for packets we * haven't sent yet. */ WARN_ON(xmit_count == 0); /* * If the packet has only been sent once, we can use it * to calculate the RTT and also open the window a little * further. */ if (xmit_count == 1) { if (dn_equal(segnum, acknum)) dn_nsp_rtt(sk, (long)(pkttime - reftime)); if (scp->snd_window < scp->max_window) scp->snd_window++; } /* * Packet has been sent more than once. If this is the last * packet to be acknowledged then we want to send the next * packet in the send queue again (assumes the remote host does * go-back-N error control). */ if (xmit_count > 1) try_retrans = 1; } if (try_retrans) dn_nsp_output(sk); return wakeup;}
开发者ID:flwh,项目名称:Alcatel_OT_985_kernel,代码行数:72,
示例18: dn_nsp_backlog_rcv/* * This is the main receive routine for sockets. It is called * from the above when the socket is not busy, and also from * sock_release() when there is a backlog queued up. */int dn_nsp_backlog_rcv(struct sock *sk, struct sk_buff *skb){ struct dn_scp *scp = DN_SK(sk); struct dn_skb_cb *cb = DN_SKB_CB(skb); if (cb->rt_flags & DN_RT_F_RTS) { if (cb->nsp_flags == 0x18 || cb->nsp_flags == 0x68) dn_returned_conn_init(sk, skb); else kfree_skb(skb); return NET_RX_SUCCESS; } /* * Control packet. */ if ((cb->nsp_flags & 0x0c) == 0x08) { switch (cb->nsp_flags & 0x70) { case 0x10: case 0x60: dn_nsp_conn_init(sk, skb); break; case 0x20: dn_nsp_conn_conf(sk, skb); break; case 0x30: dn_nsp_disc_init(sk, skb); break; case 0x40: dn_nsp_disc_conf(sk, skb); break; } } else if (cb->nsp_flags == 0x24) { /* * Special for connacks, 'cos they don't have * ack data or ack otherdata info. */ dn_nsp_conn_ack(sk, skb); } else { int other = 1; /* both data and ack frames can kick a CC socket into RUN */ if ((scp->state == DN_CC) && !sock_flag(sk, SOCK_DEAD)) { scp->state = DN_RUN; sk->sk_state = TCP_ESTABLISHED; sk->sk_state_change(sk); } if ((cb->nsp_flags & 0x1c) == 0) other = 0; if (cb->nsp_flags == 0x04) other = 0; /* * Read out ack data here, this applies equally * to data, other data, link serivce and both * ack data and ack otherdata. */ dn_process_ack(sk, skb, other); /* * If we've some sort of data here then call a * suitable routine for dealing with it, otherwise * the packet is an ack and can be discarded. */ if ((cb->nsp_flags & 0x0c) == 0) { if (scp->state != DN_RUN) goto free_out; switch (cb->nsp_flags) { case 0x10: /* LS */ dn_nsp_linkservice(sk, skb); break; case 0x30: /* OD */ dn_nsp_otherdata(sk, skb); break; default: dn_nsp_data(sk, skb); } } else { /* Ack, chuck it out here */free_out: kfree_skb(skb); } } return NET_RX_SUCCESS;}
开发者ID:AlexShiLucky,项目名称:linux,代码行数:95,
注:本文中的DN_SKB_CB函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ DO函数代码示例 C++ DN_SK函数代码示例 |