xref: /freebsd/sys/dev/wtap/plugins/visibility.h (revision 95ee2897e98f5d444f26ed2334cc7c439f9c16c6)
104d19802SAdrian Chadd /*-
2*4d846d26SWarner Losh  * SPDX-License-Identifier: BSD-2-Clause
3718cf2ccSPedro F. Giffuni  *
404d19802SAdrian Chadd  * Copyright (c) 2011 Monthadar Al Jaberi, TerraNet AB
504d19802SAdrian Chadd  * All rights reserved.
604d19802SAdrian Chadd  *
704d19802SAdrian Chadd  * Redistribution and use in source and binary forms, with or without
804d19802SAdrian Chadd  * modification, are permitted provided that the following conditions
904d19802SAdrian Chadd  * are met:
1004d19802SAdrian Chadd  * 1. Redistributions of source code must retain the above copyright
1104d19802SAdrian Chadd  *    notice, this list of conditions and the following disclaimer,
1204d19802SAdrian Chadd  *    without modification.
1304d19802SAdrian Chadd  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
1404d19802SAdrian Chadd  *    similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any
1504d19802SAdrian Chadd  *    redistribution must be conditioned upon including a substantially
1604d19802SAdrian Chadd  *    similar Disclaimer requirement for further binary redistribution.
1704d19802SAdrian Chadd  *
1804d19802SAdrian Chadd  * NO WARRANTY
1904d19802SAdrian Chadd  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
2004d19802SAdrian Chadd  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
2104d19802SAdrian Chadd  * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY
2204d19802SAdrian Chadd  * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
2304d19802SAdrian Chadd  * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY,
2404d19802SAdrian Chadd  * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
2504d19802SAdrian Chadd  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
2604d19802SAdrian Chadd  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
2704d19802SAdrian Chadd  * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
2804d19802SAdrian Chadd  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
2904d19802SAdrian Chadd  * THE POSSIBILITY OF SUCH DAMAGES.
3004d19802SAdrian Chadd  */
3104d19802SAdrian Chadd #ifndef _VISIBILITY_H_
3204d19802SAdrian Chadd #define _VISIBILITY_H_
3304d19802SAdrian Chadd 
3404d19802SAdrian Chadd #include "wtap_plugin.h"
3504d19802SAdrian Chadd #include "visibility_ioctl.h"
3604d19802SAdrian Chadd 
3704d19802SAdrian Chadd #define CDEV_GET_SOFTC(x) (x)->si_drv1
3804d19802SAdrian Chadd 
3904d19802SAdrian Chadd #define ARRAY_SIZE (32) //We support a maximum of 1024 nodes for now
4004d19802SAdrian Chadd 
4104d19802SAdrian Chadd struct vis_map {
4204d19802SAdrian Chadd 	uint32_t map[ARRAY_SIZE];
4304d19802SAdrian Chadd };
4404d19802SAdrian Chadd 
4504d19802SAdrian Chadd struct visibility_plugin {
4604d19802SAdrian Chadd 	struct wtap_plugin	base;
4704d19802SAdrian Chadd 	struct mtx		pl_mtx;
4804d19802SAdrian Chadd 	struct vis_map pl_node[MAX_NBR_WTAP];
4904d19802SAdrian Chadd };
5004d19802SAdrian Chadd 
5104d19802SAdrian Chadd void visibility_init(struct wtap_plugin *);
5204d19802SAdrian Chadd void visibility_deinit(struct wtap_plugin *);
5304d19802SAdrian Chadd void visibility_work(struct wtap_plugin *, struct packet *);
5404d19802SAdrian Chadd 
5504d19802SAdrian Chadd #endif
56