10Sstevel@tonic-gate /* 20Sstevel@tonic-gate * CDDL HEADER START 30Sstevel@tonic-gate * 40Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*8485SPeter.Memishian@Sun.COM * Common Development and Distribution License (the "License"). 6*8485SPeter.Memishian@Sun.COM * You may not use this file except in compliance with the License. 70Sstevel@tonic-gate * 80Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 90Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 100Sstevel@tonic-gate * See the License for the specific language governing permissions 110Sstevel@tonic-gate * and limitations under the License. 120Sstevel@tonic-gate * 130Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 140Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 150Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 160Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 170Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 180Sstevel@tonic-gate * 190Sstevel@tonic-gate * CDDL HEADER END 200Sstevel@tonic-gate */ 210Sstevel@tonic-gate /* 22*8485SPeter.Memishian@Sun.COM * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 230Sstevel@tonic-gate * Use is subject to license terms. 240Sstevel@tonic-gate */ 250Sstevel@tonic-gate 260Sstevel@tonic-gate #ifndef _IPP_IPGPC_CLASSIFIER_H 270Sstevel@tonic-gate #define _IPP_IPGPC_CLASSIFIER_H 280Sstevel@tonic-gate 290Sstevel@tonic-gate #include <sys/types.h> 300Sstevel@tonic-gate #include <sys/cmn_err.h> 310Sstevel@tonic-gate #include <ipp/ipgpc/filters.h> 320Sstevel@tonic-gate 330Sstevel@tonic-gate #ifdef __cplusplus 340Sstevel@tonic-gate extern "C" { 350Sstevel@tonic-gate #endif 360Sstevel@tonic-gate 370Sstevel@tonic-gate /* Header file for classifier implementation for ipgpc */ 380Sstevel@tonic-gate 390Sstevel@tonic-gate #define IPGPC_DEBUG 400Sstevel@tonic-gate 410Sstevel@tonic-gate #ifdef IPGPC_DEBUG 420Sstevel@tonic-gate #include <sys/debug.h> 430Sstevel@tonic-gate 440Sstevel@tonic-gate #define ipgpc0dbg(a) printf a 450Sstevel@tonic-gate #define ipgpc1dbg(a) if (ipgpc_debug > 2) printf a 460Sstevel@tonic-gate #define ipgpc2dbg(a) if (ipgpc_debug > 3) printf a 470Sstevel@tonic-gate #define ipgpc3dbg(a) if (ipgpc_debug > 4) printf a 480Sstevel@tonic-gate #define ipgpc4dbg(a) if (ipgpc_debug > 5) printf a 490Sstevel@tonic-gate #else 500Sstevel@tonic-gate #define ipgpc0dbg(a) /* */ 510Sstevel@tonic-gate #define ipgpc1dbg(a) /* */ 520Sstevel@tonic-gate #define ipgpc2dbg(a) /* */ 530Sstevel@tonic-gate #define ipgpc3dbg(a) /* */ 540Sstevel@tonic-gate #define ipgpc4dbg(a) /* */ 550Sstevel@tonic-gate #endif /* IPGPC_DEBUG */ 560Sstevel@tonic-gate 570Sstevel@tonic-gate #define BUMP_STATS(x) ++(x) 580Sstevel@tonic-gate #define SET_STATS(x, y) x = y 590Sstevel@tonic-gate #define UPDATE_STATS(x, y) x += y 600Sstevel@tonic-gate 610Sstevel@tonic-gate /* packet structure */ 620Sstevel@tonic-gate typedef struct ipgpc_packet_s { 630Sstevel@tonic-gate /* IP Addresses are represented as IPV6 address structures */ 640Sstevel@tonic-gate in6_addr_t saddr; /* IP source address */ 650Sstevel@tonic-gate in6_addr_t daddr; /* IP destination address */ 660Sstevel@tonic-gate uint16_t sport; /* source port */ 670Sstevel@tonic-gate uint16_t dport; /* destination port */ 680Sstevel@tonic-gate uint8_t proto; /* protocol field */ 690Sstevel@tonic-gate uint8_t dsfield; /* Traffic class/DS */ 700Sstevel@tonic-gate uid_t uid; /* user id for packet */ 710Sstevel@tonic-gate projid_t projid; /* project id for packet */ 720Sstevel@tonic-gate uint_t if_index; /* interface index */ 730Sstevel@tonic-gate uint32_t direction; /* packet direction */ 740Sstevel@tonic-gate uint_t len; /* length of packet */ 750Sstevel@tonic-gate } ipgpc_packet_t; 760Sstevel@tonic-gate 770Sstevel@tonic-gate extern int ipgpc_debug; 780Sstevel@tonic-gate extern boolean_t ipgpc_action_exist; /* if an ipgpc action exists */ 790Sstevel@tonic-gate 800Sstevel@tonic-gate extern ipgpc_class_t *ipgpc_classify(int, ipgpc_packet_t *); 810Sstevel@tonic-gate extern void parse_packet(ipgpc_packet_t *, mblk_t *); 820Sstevel@tonic-gate extern void parse_packet6(ipgpc_packet_t *, mblk_t *); 830Sstevel@tonic-gate extern void print_packet(int, ipgpc_packet_t *); 840Sstevel@tonic-gate 850Sstevel@tonic-gate #ifdef __cplusplus 860Sstevel@tonic-gate } 870Sstevel@tonic-gate #endif 880Sstevel@tonic-gate 890Sstevel@tonic-gate #endif /* _IPP_IPGPC_CLASSIFIER_H */ 90