/* * cn_queue.h * * 2004 Copyright (c) Evgeniy Polyakov * All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef __CN_QUEUE_H #define __CN_QUEUE_H #include struct cb_id { __u32 idx; __u32 val; }; #ifdef __KERNEL__ #include #include #include #define CN_CBQ_NAMELEN 32 struct cn_queue_dev { atomic_t refcnt; unsigned char name[CN_CBQ_NAMELEN]; struct workqueue_struct *cn_queue; struct list_head queue_list; spinlock_t queue_lock; int netlink_groups; struct sock *nls; }; struct cn_callback { unsigned char name[CN_CBQ_NAMELEN]; struct cb_id id; void (* callback)(void *); void *priv; atomic_t refcnt; }; struct cn_callback_entry { struct list_head callback_entry; struct cn_callback *cb; struct work_struct work; struct cn_queue_dev *pdev; void (* destruct_data)(void *); void *ddata; int seq, group; struct sock *nls; }; int cn_queue_add_callback(struct cn_queue_dev *dev, struct cn_callback *cb); void cn_queue_del_callback(struct cn_queue_dev *dev, struct cn_callback *cb); struct cn_queue_dev *cn_queue_alloc_dev(char *name, struct sock *); void cn_queue_free_dev(struct cn_queue_dev *dev); int cn_cb_equal(struct cb_id *, struct cb_id *); #endif /* __KERNEL__ */ #endif /* __CN_QUEUE_H */