LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 850|回复: 0

bsd4.4 output函数

[复制链接]
发表于 2006-12-4 13:39:30 | 显示全部楼层 |阅读模式
int ether_outpu(struct ifnet *ifp,struct mbuf *m0,struct sockaddr *dst,struct rtentry *rt0);
m0指的是第一个链表还是所有的链表呢。如果是所有链表那么下面的代码怎么解释呢?
           short  type;
                 u_char edst[6];
                 struct arpcom *ac;

           struct ether_header *eh=mtod(m,struct ether_header *);
               short  type = htons((u_short)type);
        bcopy((caddr_t)&type,(caddr_t)&eh->ether_type,
                sizeof(eh->ether_type));
        bcopy((caddr_t)edst, (caddr_t)eh->ether_dhost, sizeof (edst));
        bcopy((caddr_t)ac->ac_enaddr, (caddr_t)eh->ether_shost,
            sizeof(eh->ether_shost));
这里面mbuf怎么样将全部的内容正好转换成ether_header结构的呢。谢谢大伙帮忙解释一下。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表