15440Sjm199354 /* 25440Sjm199354 * CDDL HEADER START 35440Sjm199354 * 45440Sjm199354 * The contents of this file are subject to the terms of the 55440Sjm199354 * Common Development and Distribution License (the "License"). 65440Sjm199354 * You may not use this file except in compliance with the License. 75440Sjm199354 * 85440Sjm199354 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 95440Sjm199354 * or http://www.opensolaris.org/os/licensing. 105440Sjm199354 * See the License for the specific language governing permissions 115440Sjm199354 * and limitations under the License. 125440Sjm199354 * 135440Sjm199354 * When distributing Covered Code, include this CDDL HEADER in each 145440Sjm199354 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 155440Sjm199354 * If applicable, add the following below this CDDL HEADER, with the 165440Sjm199354 * fields enclosed by brackets "[]" replaced with your own identifying 175440Sjm199354 * information: Portions Copyright [yyyy] [name of copyright owner] 185440Sjm199354 * 195440Sjm199354 * CDDL HEADER END 205440Sjm199354 */ 215440Sjm199354 /* 225931Sjm199354 * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 235440Sjm199354 * Use is subject to license terms. 245440Sjm199354 */ 255440Sjm199354 265440Sjm199354 #ifndef _VSCAN_H 275440Sjm199354 #define _VSCAN_H 285440Sjm199354 295440Sjm199354 #pragma ident "%Z%%M% %I% %E% SMI" 305440Sjm199354 315440Sjm199354 #ifdef __cplusplus 325440Sjm199354 extern "C" { 335440Sjm199354 #endif 345440Sjm199354 355440Sjm199354 #include <sys/param.h> 365440Sjm199354 #include <sys/vnode.h> 375440Sjm199354 385440Sjm199354 /* 395440Sjm199354 * vscan.h provides definitions for vscan kernel module 405440Sjm199354 */ 415440Sjm199354 42*6407Sjm199354 #define VS_DRV_PATH "/dev/vscan/vscan" /* append minor dev num */ 43*6407Sjm199354 44*6407Sjm199354 #define VS_IOCTL_ENABLE 0x01 /* door rendezvous */ 45*6407Sjm199354 #define VS_IOCTL_DISABLE 0x02 /* vscand shutting down */ 46*6407Sjm199354 #define VS_IOCTL_CONFIG 0x03 /* vscand config data update */ 47*6407Sjm199354 #define VS_IOCTL_RESULT 0x04 /* scan result */ 48*6407Sjm199354 #define VS_IOCTL_MAX_REQ 0x05 /* max in-progress req vscand */ 495440Sjm199354 505931Sjm199354 /* Scan Result - vsr_result */ 515931Sjm199354 #define VS_STATUS_UNDEFINED 0 52*6407Sjm199354 #define VS_STATUS_NO_SCAN 1 /* scan not required */ 53*6407Sjm199354 #define VS_STATUS_ERROR 2 /* scan failed */ 54*6407Sjm199354 #define VS_STATUS_CLEAN 3 /* scan successful, file clean */ 55*6407Sjm199354 #define VS_STATUS_INFECTED 4 /* scan successful, file infected */ 56*6407Sjm199354 #define VS_STATUS_SCANNING 5 /* scan in progress - async */ 575440Sjm199354 58*6407Sjm199354 /* Configuration data vs_config_t - vsc_types */ 595440Sjm199354 #define VS_TYPES_LEN 4096 /* vs_config_t - types buffer */ 60*6407Sjm199354 #define VS_TYPES_MAX VS_TYPES_LEN / 2 61*6407Sjm199354 625440Sjm199354 635440Sjm199354 /* 645440Sjm199354 * AV_SCANSTAMP_SZ is the size of the scanstamp stored in the 655440Sjm199354 * filesystem. vs_scanstamp_t is 1 character longer to allow 665440Sjm199354 * a null terminated string to be used within vscan 675440Sjm199354 */ 685440Sjm199354 typedef char vs_scanstamp_t[AV_SCANSTAMP_SZ + 1]; 695440Sjm199354 70*6407Sjm199354 /* used for door request to vscand */ 715440Sjm199354 typedef struct vs_scan_req { 72*6407Sjm199354 uint32_t vsr_idx; 73*6407Sjm199354 uint32_t vsr_seqnum; 74*6407Sjm199354 uint64_t vsr_size; 755440Sjm199354 uint32_t vsr_flags; 765440Sjm199354 uint8_t vsr_modified; 775440Sjm199354 uint8_t vsr_quarantined; 785440Sjm199354 char vsr_path[MAXPATHLEN]; 795440Sjm199354 vs_scanstamp_t vsr_scanstamp; 805440Sjm199354 } vs_scan_req_t; 815440Sjm199354 825440Sjm199354 83*6407Sjm199354 /* passed in VS_IOCTL_RESULT - async response from vscand */ 84*6407Sjm199354 typedef struct vs_scan_rsp { 85*6407Sjm199354 uint32_t vsr_idx; 86*6407Sjm199354 uint32_t vsr_seqnum; 87*6407Sjm199354 uint32_t vsr_result; 88*6407Sjm199354 vs_scanstamp_t vsr_scanstamp; 89*6407Sjm199354 } vs_scan_rsp_t; 90*6407Sjm199354 91*6407Sjm199354 92*6407Sjm199354 /* passed in VS_IOCTL_CONFIG */ 935440Sjm199354 typedef struct vs_config { 945440Sjm199354 char vsc_types[VS_TYPES_LEN]; 955440Sjm199354 uint64_t vsc_types_len; 965440Sjm199354 uint64_t vsc_max_size; /* files > max size (bytes) not scan */ 975440Sjm199354 uint64_t vsc_allow; /* allow access to file exceeding max_size? */ 985440Sjm199354 } vs_config_t; 995440Sjm199354 1005440Sjm199354 1015440Sjm199354 #ifdef _KERNEL 1025440Sjm199354 int vscan_svc_init(void); 1035440Sjm199354 void vscan_svc_fini(void); 104*6407Sjm199354 int vscan_svc_enable(void); 1055931Sjm199354 void vscan_svc_disable(void); 1065440Sjm199354 int vscan_svc_configure(vs_config_t *); 1075440Sjm199354 boolean_t vscan_svc_in_use(void); 108*6407Sjm199354 void vscan_svc_scan_result(vs_scan_rsp_t *); 109*6407Sjm199354 void vscan_svc_scan_abort(void); 1105440Sjm199354 vnode_t *vscan_svc_get_vnode(int); 1115440Sjm199354 1125440Sjm199354 int vscan_door_init(void); 1135440Sjm199354 void vscan_door_fini(void); 1145440Sjm199354 int vscan_door_open(int); 1155440Sjm199354 void vscan_door_close(void); 1165440Sjm199354 int vscan_door_scan_file(vs_scan_req_t *); 1175440Sjm199354 1185931Sjm199354 boolean_t vscan_drv_create_node(int); 1195931Sjm199354 1205440Sjm199354 #endif /* _KERNEL */ 1215440Sjm199354 1225440Sjm199354 #ifdef __cplusplus 1235440Sjm199354 } 1245440Sjm199354 #endif 1255440Sjm199354 1265440Sjm199354 1275440Sjm199354 #endif /* _VSCAN_H */ 128