1*911106dfSjm199354 /* 2*911106dfSjm199354 * CDDL HEADER START 3*911106dfSjm199354 * 4*911106dfSjm199354 * The contents of this file are subject to the terms of the 5*911106dfSjm199354 * Common Development and Distribution License (the "License"). 6*911106dfSjm199354 * You may not use this file except in compliance with the License. 7*911106dfSjm199354 * 8*911106dfSjm199354 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9*911106dfSjm199354 * or http://www.opensolaris.org/os/licensing. 10*911106dfSjm199354 * See the License for the specific language governing permissions 11*911106dfSjm199354 * and limitations under the License. 12*911106dfSjm199354 * 13*911106dfSjm199354 * When distributing Covered Code, include this CDDL HEADER in each 14*911106dfSjm199354 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15*911106dfSjm199354 * If applicable, add the following below this CDDL HEADER, with the 16*911106dfSjm199354 * fields enclosed by brackets "[]" replaced with your own identifying 17*911106dfSjm199354 * information: Portions Copyright [yyyy] [name of copyright owner] 18*911106dfSjm199354 * 19*911106dfSjm199354 * CDDL HEADER END 20*911106dfSjm199354 */ 21*911106dfSjm199354 /* 22*911106dfSjm199354 * Copyright 2007 Sun Microsystems, Inc. All rights reserved. 23*911106dfSjm199354 * Use is subject to license terms. 24*911106dfSjm199354 */ 25*911106dfSjm199354 26*911106dfSjm199354 #ifndef _VSCAN_H 27*911106dfSjm199354 #define _VSCAN_H 28*911106dfSjm199354 29*911106dfSjm199354 #pragma ident "%Z%%M% %I% %E% SMI" 30*911106dfSjm199354 31*911106dfSjm199354 #ifdef __cplusplus 32*911106dfSjm199354 extern "C" { 33*911106dfSjm199354 #endif 34*911106dfSjm199354 35*911106dfSjm199354 #include <sys/param.h> 36*911106dfSjm199354 #include <sys/vnode.h> 37*911106dfSjm199354 38*911106dfSjm199354 /* 39*911106dfSjm199354 * vscan.h provides definitions for vscan kernel module 40*911106dfSjm199354 */ 41*911106dfSjm199354 42*911106dfSjm199354 #define VS_DRV_MAX_FILES 1024 /* max concurent file scans */ 43*911106dfSjm199354 #define VS_DRV_PATH "/devices/pseudo/vscan@0:vscan" 44*911106dfSjm199354 #define VS_DRV_IOCTL_ENABLE 0x0001 /* door rendezvous */ 45*911106dfSjm199354 #define VS_DRV_IOCTL_DISABLE 0x0002 /* vscand shutting down */ 46*911106dfSjm199354 #define VS_DRV_IOCTL_CONFIG 0x0004 /* vscand config data update */ 47*911106dfSjm199354 48*911106dfSjm199354 /* vsr_access */ 49*911106dfSjm199354 #define VS_ACCESS_UNDEFINED 0 50*911106dfSjm199354 #define VS_ACCESS_ALLOW 1 51*911106dfSjm199354 #define VS_ACCESS_DENY 2 52*911106dfSjm199354 53*911106dfSjm199354 #define VS_TYPES_LEN 4096 /* vs_config_t - types buffer */ 54*911106dfSjm199354 55*911106dfSjm199354 /* 56*911106dfSjm199354 * AV_SCANSTAMP_SZ is the size of the scanstamp stored in the 57*911106dfSjm199354 * filesystem. vs_scanstamp_t is 1 character longer to allow 58*911106dfSjm199354 * a null terminated string to be used within vscan 59*911106dfSjm199354 */ 60*911106dfSjm199354 typedef char vs_scanstamp_t[AV_SCANSTAMP_SZ + 1]; 61*911106dfSjm199354 62*911106dfSjm199354 /* used for both request to and response from vscand */ 63*911106dfSjm199354 typedef struct vs_scan_req { 64*911106dfSjm199354 uint32_t vsr_id; 65*911106dfSjm199354 uint32_t vsr_flags; 66*911106dfSjm199354 uint64_t vsr_size; 67*911106dfSjm199354 uint8_t vsr_modified; 68*911106dfSjm199354 uint8_t vsr_quarantined; 69*911106dfSjm199354 char vsr_path[MAXPATHLEN]; 70*911106dfSjm199354 vs_scanstamp_t vsr_scanstamp; 71*911106dfSjm199354 uint32_t vsr_access; /* VS_ACCESS_ALLOW, VS_ACCESS_DENY */ 72*911106dfSjm199354 } vs_scan_req_t; 73*911106dfSjm199354 74*911106dfSjm199354 75*911106dfSjm199354 /* passed in VS_DRV_IOCTL_CONFIG */ 76*911106dfSjm199354 typedef struct vs_config { 77*911106dfSjm199354 char vsc_types[VS_TYPES_LEN]; 78*911106dfSjm199354 uint64_t vsc_types_len; 79*911106dfSjm199354 uint64_t vsc_max_size; /* files > max size (bytes) not scan */ 80*911106dfSjm199354 uint64_t vsc_allow; /* allow access to file exceeding max_size? */ 81*911106dfSjm199354 } vs_config_t; 82*911106dfSjm199354 83*911106dfSjm199354 84*911106dfSjm199354 #ifdef _KERNEL 85*911106dfSjm199354 86*911106dfSjm199354 /* 87*911106dfSjm199354 * max no of types in vs_config_t.vsc_types 88*911106dfSjm199354 * used as dimention for array of pointers to types 89*911106dfSjm199354 */ 90*911106dfSjm199354 #define VS_TYPES_MAX VS_TYPES_LEN / 2 91*911106dfSjm199354 92*911106dfSjm199354 int vscan_svc_init(void); 93*911106dfSjm199354 void vscan_svc_fini(void); 94*911106dfSjm199354 void vscan_svc_enable(boolean_t); 95*911106dfSjm199354 int vscan_svc_configure(vs_config_t *); 96*911106dfSjm199354 boolean_t vscan_svc_in_use(void); 97*911106dfSjm199354 vnode_t *vscan_svc_get_vnode(int); 98*911106dfSjm199354 99*911106dfSjm199354 int vscan_door_init(void); 100*911106dfSjm199354 void vscan_door_fini(void); 101*911106dfSjm199354 int vscan_door_open(int); 102*911106dfSjm199354 void vscan_door_close(void); 103*911106dfSjm199354 int vscan_door_scan_file(vs_scan_req_t *); 104*911106dfSjm199354 105*911106dfSjm199354 #endif /* _KERNEL */ 106*911106dfSjm199354 107*911106dfSjm199354 #ifdef __cplusplus 108*911106dfSjm199354 } 109*911106dfSjm199354 #endif 110*911106dfSjm199354 111*911106dfSjm199354 112*911106dfSjm199354 #endif /* _VSCAN_H */ 113