本文整理汇总了C++中x25_type_trans函数的典型用法代码示例。如果您正苦于以下问题:C++ x25_type_trans函数的具体用法?C++ x25_type_trans怎么用?C++ x25_type_trans使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了x25_type_trans函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: x25_asy_bump
static void x25_asy_bump(struct x25_asy *sl)
{
struct net_device *dev = sl->dev;
struct sk_buff *skb;
int count;
int err;
count = sl->rcount;
dev->stats.rx_bytes += count;
skb = dev_alloc_skb(count+1);
if (skb == NULL) {
netdev_warn(sl->dev, "memory squeeze, dropping packet\n");
dev->stats.rx_dropped++;
return;
}
skb_push(skb, 1); /* LAPB internal control */
skb_put_data(skb, sl->rbuff, count);
skb->protocol = x25_type_trans(skb, sl->dev);
err = lapb_data_received(skb->dev, skb);
if (err != LAPB_OK) {
kfree_skb(skb);
printk(KERN_DEBUG "x25_asy: data received err - %d\n", err);
} else {
netif_rx(skb);
dev->stats.rx_packets++;
}
}
示例2: x25_asy_bump
static void x25_asy_bump(struct x25_asy *sl)
{
struct sk_buff *skb;
int count;
int err;
count = sl->rcount;
sl->stats.rx_bytes+=count;
skb = dev_alloc_skb(count+1);
if (skb == NULL)
{
printk("%s: memory squeeze, dropping packet.\n", sl->dev->name);
sl->stats.rx_dropped++;
return;
}
skb_push(skb,1); /* LAPB internal control */
memcpy(skb_put(skb,count), sl->rbuff, count);
skb->protocol = x25_type_trans(skb, sl->dev);
if((err=lapb_data_received(skb->dev, skb))!=LAPB_OK)
{
kfree_skb(skb);
printk(KERN_DEBUG "x25_asy: data received err - %d\n",err);
}
else
{
netif_rx(skb);
sl->dev->last_rx = jiffies;
sl->stats.rx_packets++;
}
}
示例3: x25_data_indication
static int x25_data_indication(struct net_device *dev, struct sk_buff *skb)
{
unsigned char *ptr;
skb_push(skb, 1);
if (skb_cow(skb, 1))
return NET_RX_DROP;
ptr = skb->data;
*ptr = X25_IFACE_DATA;
skb->protocol = x25_type_trans(skb, dev);
return netif_rx(skb);
}
示例4: x25_connect_disconnect
static void x25_connect_disconnect(struct net_device *dev, int reason, int code)
{
struct sk_buff *skb;
unsigned char *ptr;
if ((skb = dev_alloc_skb(1)) == NULL) {
printk(KERN_ERR "%s: out of memory\n", dev->name);
return;
}
ptr = skb_put(skb, 1);
*ptr = code;
skb->protocol = x25_type_trans(skb, dev);
netif_rx(skb);
}
示例5: x25_asy_disconnected
static void x25_asy_disconnected(struct net_device *dev, int reason)
{
struct x25_asy *sl = dev->priv;
struct sk_buff *skb;
unsigned char *ptr;
if ((skb = dev_alloc_skb(1)) == NULL) {
printk(KERN_ERR "x25_asy: out of memory\n");
return;
}
ptr = skb_put(skb, 1);
*ptr = 0x02;
skb->protocol = x25_type_trans(skb, sl->dev);
netif_rx(skb);
}
示例6: x25_asy_disconnected
static void x25_asy_disconnected(struct net_device *dev, int reason)
{
struct x25_asy *sl = netdev_priv(dev);
struct sk_buff *skb;
unsigned char *ptr;
skb = dev_alloc_skb(1);
if (skb == NULL) {
netdev_err(dev, "out of memory\n");
return;
}
ptr = skb_put(skb, 1);
*ptr = X25_IFACE_DISCONNECT;
skb->protocol = x25_type_trans(skb, sl->dev);
netif_rx(skb);
}