vscan.h revision 911106dfb16696472af8c1b7b4c554a829354fa8
911106dfb16696472af8c1b7b4c554a829354fa8jm/*
911106dfb16696472af8c1b7b4c554a829354fa8jm * CDDL HEADER START
911106dfb16696472af8c1b7b4c554a829354fa8jm *
911106dfb16696472af8c1b7b4c554a829354fa8jm * The contents of this file are subject to the terms of the
911106dfb16696472af8c1b7b4c554a829354fa8jm * Common Development and Distribution License (the "License").
911106dfb16696472af8c1b7b4c554a829354fa8jm * You may not use this file except in compliance with the License.
911106dfb16696472af8c1b7b4c554a829354fa8jm *
911106dfb16696472af8c1b7b4c554a829354fa8jm * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
911106dfb16696472af8c1b7b4c554a829354fa8jm * or http://www.opensolaris.org/os/licensing.
911106dfb16696472af8c1b7b4c554a829354fa8jm * See the License for the specific language governing permissions
911106dfb16696472af8c1b7b4c554a829354fa8jm * and limitations under the License.
911106dfb16696472af8c1b7b4c554a829354fa8jm *
911106dfb16696472af8c1b7b4c554a829354fa8jm * When distributing Covered Code, include this CDDL HEADER in each
911106dfb16696472af8c1b7b4c554a829354fa8jm * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
911106dfb16696472af8c1b7b4c554a829354fa8jm * If applicable, add the following below this CDDL HEADER, with the
911106dfb16696472af8c1b7b4c554a829354fa8jm * fields enclosed by brackets "[]" replaced with your own identifying
911106dfb16696472af8c1b7b4c554a829354fa8jm * information: Portions Copyright [yyyy] [name of copyright owner]
911106dfb16696472af8c1b7b4c554a829354fa8jm *
911106dfb16696472af8c1b7b4c554a829354fa8jm * CDDL HEADER END
911106dfb16696472af8c1b7b4c554a829354fa8jm */
911106dfb16696472af8c1b7b4c554a829354fa8jm/*
911106dfb16696472af8c1b7b4c554a829354fa8jm * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
911106dfb16696472af8c1b7b4c554a829354fa8jm * Use is subject to license terms.
911106dfb16696472af8c1b7b4c554a829354fa8jm */
911106dfb16696472af8c1b7b4c554a829354fa8jm
911106dfb16696472af8c1b7b4c554a829354fa8jm#ifndef _VSCAN_H
911106dfb16696472af8c1b7b4c554a829354fa8jm#define _VSCAN_H
911106dfb16696472af8c1b7b4c554a829354fa8jm
911106dfb16696472af8c1b7b4c554a829354fa8jm#pragma ident "%Z%%M% %I% %E% SMI"
911106dfb16696472af8c1b7b4c554a829354fa8jm
911106dfb16696472af8c1b7b4c554a829354fa8jm#ifdef __cplusplus
911106dfb16696472af8c1b7b4c554a829354fa8jmextern "C" {
911106dfb16696472af8c1b7b4c554a829354fa8jm#endif
911106dfb16696472af8c1b7b4c554a829354fa8jm
911106dfb16696472af8c1b7b4c554a829354fa8jm#include <sys/param.h>
911106dfb16696472af8c1b7b4c554a829354fa8jm#include <sys/vnode.h>
911106dfb16696472af8c1b7b4c554a829354fa8jm
911106dfb16696472af8c1b7b4c554a829354fa8jm/*
911106dfb16696472af8c1b7b4c554a829354fa8jm * vscan.h provides definitions for vscan kernel module
911106dfb16696472af8c1b7b4c554a829354fa8jm */
911106dfb16696472af8c1b7b4c554a829354fa8jm
911106dfb16696472af8c1b7b4c554a829354fa8jm#define VS_DRV_MAX_FILES 1024 /* max concurent file scans */
911106dfb16696472af8c1b7b4c554a829354fa8jm#define VS_DRV_PATH "/devices/pseudo/vscan@0:vscan"
911106dfb16696472af8c1b7b4c554a829354fa8jm#define VS_DRV_IOCTL_ENABLE 0x0001 /* door rendezvous */
911106dfb16696472af8c1b7b4c554a829354fa8jm#define VS_DRV_IOCTL_DISABLE 0x0002 /* vscand shutting down */
911106dfb16696472af8c1b7b4c554a829354fa8jm#define VS_DRV_IOCTL_CONFIG 0x0004 /* vscand config data update */
911106dfb16696472af8c1b7b4c554a829354fa8jm
911106dfb16696472af8c1b7b4c554a829354fa8jm/* vsr_access */
911106dfb16696472af8c1b7b4c554a829354fa8jm#define VS_ACCESS_UNDEFINED 0
911106dfb16696472af8c1b7b4c554a829354fa8jm#define VS_ACCESS_ALLOW 1
911106dfb16696472af8c1b7b4c554a829354fa8jm#define VS_ACCESS_DENY 2
911106dfb16696472af8c1b7b4c554a829354fa8jm
911106dfb16696472af8c1b7b4c554a829354fa8jm#define VS_TYPES_LEN 4096 /* vs_config_t - types buffer */
911106dfb16696472af8c1b7b4c554a829354fa8jm
911106dfb16696472af8c1b7b4c554a829354fa8jm/*
911106dfb16696472af8c1b7b4c554a829354fa8jm * AV_SCANSTAMP_SZ is the size of the scanstamp stored in the
911106dfb16696472af8c1b7b4c554a829354fa8jm * filesystem. vs_scanstamp_t is 1 character longer to allow
911106dfb16696472af8c1b7b4c554a829354fa8jm * a null terminated string to be used within vscan
911106dfb16696472af8c1b7b4c554a829354fa8jm */
911106dfb16696472af8c1b7b4c554a829354fa8jmtypedef char vs_scanstamp_t[AV_SCANSTAMP_SZ + 1];
911106dfb16696472af8c1b7b4c554a829354fa8jm
911106dfb16696472af8c1b7b4c554a829354fa8jm/* used for both request to and response from vscand */
911106dfb16696472af8c1b7b4c554a829354fa8jmtypedef struct vs_scan_req {
911106dfb16696472af8c1b7b4c554a829354fa8jm uint32_t vsr_id;
911106dfb16696472af8c1b7b4c554a829354fa8jm uint32_t vsr_flags;
911106dfb16696472af8c1b7b4c554a829354fa8jm uint64_t vsr_size;
911106dfb16696472af8c1b7b4c554a829354fa8jm uint8_t vsr_modified;
911106dfb16696472af8c1b7b4c554a829354fa8jm uint8_t vsr_quarantined;
911106dfb16696472af8c1b7b4c554a829354fa8jm char vsr_path[MAXPATHLEN];
911106dfb16696472af8c1b7b4c554a829354fa8jm vs_scanstamp_t vsr_scanstamp;
911106dfb16696472af8c1b7b4c554a829354fa8jm uint32_t vsr_access; /* VS_ACCESS_ALLOW, VS_ACCESS_DENY */
911106dfb16696472af8c1b7b4c554a829354fa8jm} vs_scan_req_t;
911106dfb16696472af8c1b7b4c554a829354fa8jm
911106dfb16696472af8c1b7b4c554a829354fa8jm
911106dfb16696472af8c1b7b4c554a829354fa8jm/* passed in VS_DRV_IOCTL_CONFIG */
911106dfb16696472af8c1b7b4c554a829354fa8jmtypedef struct vs_config {
911106dfb16696472af8c1b7b4c554a829354fa8jm char vsc_types[VS_TYPES_LEN];
911106dfb16696472af8c1b7b4c554a829354fa8jm uint64_t vsc_types_len;
911106dfb16696472af8c1b7b4c554a829354fa8jm uint64_t vsc_max_size; /* files > max size (bytes) not scan */
911106dfb16696472af8c1b7b4c554a829354fa8jm uint64_t vsc_allow; /* allow access to file exceeding max_size? */
911106dfb16696472af8c1b7b4c554a829354fa8jm} vs_config_t;
911106dfb16696472af8c1b7b4c554a829354fa8jm
911106dfb16696472af8c1b7b4c554a829354fa8jm
911106dfb16696472af8c1b7b4c554a829354fa8jm#ifdef _KERNEL
911106dfb16696472af8c1b7b4c554a829354fa8jm
911106dfb16696472af8c1b7b4c554a829354fa8jm/*
911106dfb16696472af8c1b7b4c554a829354fa8jm * max no of types in vs_config_t.vsc_types
911106dfb16696472af8c1b7b4c554a829354fa8jm * used as dimention for array of pointers to types
911106dfb16696472af8c1b7b4c554a829354fa8jm */
911106dfb16696472af8c1b7b4c554a829354fa8jm#define VS_TYPES_MAX VS_TYPES_LEN / 2
911106dfb16696472af8c1b7b4c554a829354fa8jm
911106dfb16696472af8c1b7b4c554a829354fa8jmint vscan_svc_init(void);
911106dfb16696472af8c1b7b4c554a829354fa8jmvoid vscan_svc_fini(void);
911106dfb16696472af8c1b7b4c554a829354fa8jmvoid vscan_svc_enable(boolean_t);
911106dfb16696472af8c1b7b4c554a829354fa8jmint vscan_svc_configure(vs_config_t *);
911106dfb16696472af8c1b7b4c554a829354fa8jmboolean_t vscan_svc_in_use(void);
911106dfb16696472af8c1b7b4c554a829354fa8jmvnode_t *vscan_svc_get_vnode(int);
911106dfb16696472af8c1b7b4c554a829354fa8jm
911106dfb16696472af8c1b7b4c554a829354fa8jmint vscan_door_init(void);
911106dfb16696472af8c1b7b4c554a829354fa8jmvoid vscan_door_fini(void);
911106dfb16696472af8c1b7b4c554a829354fa8jmint vscan_door_open(int);
911106dfb16696472af8c1b7b4c554a829354fa8jmvoid vscan_door_close(void);
911106dfb16696472af8c1b7b4c554a829354fa8jmint vscan_door_scan_file(vs_scan_req_t *);
911106dfb16696472af8c1b7b4c554a829354fa8jm
911106dfb16696472af8c1b7b4c554a829354fa8jm#endif /* _KERNEL */
911106dfb16696472af8c1b7b4c554a829354fa8jm
911106dfb16696472af8c1b7b4c554a829354fa8jm#ifdef __cplusplus
911106dfb16696472af8c1b7b4c554a829354fa8jm}
911106dfb16696472af8c1b7b4c554a829354fa8jm#endif
911106dfb16696472af8c1b7b4c554a829354fa8jm
911106dfb16696472af8c1b7b4c554a829354fa8jm
911106dfb16696472af8c1b7b4c554a829354fa8jm#endif /* _VSCAN_H */