--- web100_stats.c.0 Wed Feb 20 08:15:56 2002 +++ web100_stats.c Wed Feb 20 08:24:03 2002 @@ -25,6 +25,10 @@ #include #include #include +#include +#include +#include +#include #include #define WC_INF32 0xffffffff @@ -226,6 +230,7 @@ void web100_stats_destroy(struct web100stats *stats) { + web100_netlink_event(1,stats->wc_cid); stats_persist(stats); web100_stats_unuse(stats); } @@ -278,6 +283,7 @@ vars->RecvISS = vars->rcv_nxt = tp->rcv_nxt; stats_link(stats); + web100_netlink_event(0,stats->wc_cid); } /* @@ -582,3 +588,47 @@ tp->rcv_ssthresh = min(tp->rcv_ssthresh, tp->window_clamp); tp->snd_cwnd_stamp = tcp_time_stamp; } + +/* thd netlink stuff + * also a mod in tcp.c + * mod linux/netlink.h NETLINK_WEB100 10 +*/ + +static struct sock *hndl; +/* this would handle writes from the user to raw socket or /dev/web100 */ +static int web100_netlink_call(minor,skb) +int minor; +struct sk_buff *skb; +{ + return 0; +} + +int web100_netlink_init() +{ + /* attach to web100 device, called once at boot */ + hndl =netlink_kernel_create(NETLINK_WEB100, web100_netlink_call); + if (hndl == NULL) + printk("KERN_INFO web100_netlink create failure\n"); + return 0; +} + +void web100_netlink_event(int type, int cid) +{ + /* post an event to the daemon(s) */ + struct Msg { + int type; + int cid; + } *msg; + struct sk_buff *tmpskb; + + if (hndl == NULL) return; + tmpskb=alloc_skb((sizeof(struct Msg)), GFP_ATOMIC); + if(tmpskb) { + skb_put(tmpskb,sizeof(struct Msg)); + msg = (struct Msg *)tmpskb->data; + msg->type = type; + msg->cid = cid; + netlink_broadcast(hndl, tmpskb, 0, ~0, GFP_ATOMIC); + } else + printk(KERN_INFO "web100_netlink alloc_skb failure\n"); +}