/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* PRIVATE header file for the icap client vs_icap.c
*/
#ifndef _VS_ICAP_H_
#define _VS_ICAP_H_
#pragma ident "%Z%%M% %I% %E% SMI"
#ifdef __cplusplus
extern "C" {
#endif
/* macros */
/* max sizes for vs_options_t */
/*
* The Symantec ICAP server REQUIRES the "avscan" resource name
* after the IP address in the OPTIONS and RESPMOD requests
* This is ignored by the other ICAP servers.
*/
/* previewing files */
/* defines which files types should be previewed */
typedef enum {
} vs_preview_t;
/* valid ICAP response codes */
typedef enum {
/* Symantec additions - not ICAP standard */
/* all else */
/* the ICAP OPTIONS HEADERS used by NAS AVA */
typedef enum {
/*
* the ICAP RESPMOD RESPONSE HEADERS used by NAS AVA
*
* Do NOT change the order of:
* VS_RESP_X_VIRUS_ID, VS_RESP_X_INFECTION, VS_RESP_X_VIOLATIONS
* Virus data saved from any one of these headers may be replaced
* with data found in a preferable header (one with more info).
* They are listed in order of preference.
*/
typedef enum {
/*
* vs_options_t
* vs_impl.c manages an array of vs_options_t, one per scan engine.
* vs_options_t is used to store the scan engine configuration info
* returned from the scan engine in the ICAP OPTIONS RESPONSE.
* This information is then used to determine how to communicate with
* the scan engines (eg which files to preview), when to resend the
* ICAP OPTIONS REQUEST, and the istag is used as the scanstamp of
* the file. The istag is also returned in the ICAP RESPMOD RESPONSE
* and is used to update the stored one if it has changed.
*/
typedef struct vs_options {
/* host & port used to detect config changes */
int vso_port;
/* configuration options returned from scan engine */
} vs_options_t;
/*
* vs_info_t
*
* vs_info_t is part of the context created for each scan engine request.
* threat_hdr_t defines from which header the virus information was
* obtained. This is used to determine whether to overwrite existing
* info if a 'better' header is found.
*/
typedef struct vs_info {
/* response header information */
int vsi_icap_rc;
int vsi_http_rc;
int vsi_threat_hdr;
} vs_info_t;
/*
* vs_scan_ctx_t
*
* A vs_scan_ctx_t is created for each scan request. It will contain
* everything that is needed to process the scan request and return
* the response to the caller.
* - engine connection information used to identify which scan engine
* the request is being sent to,
* - information about the file being scanned,
* - a place to store information about the file that will be created
* to hold cleaned data if the scan engine detects an infection
* and returns a cleaned version of the file,
* - a copy of the vs_options_t for the scan engine. This allows the
* NAS AVA scan engine connection parameters to be reconfigured without
* affecting any in-progress requests,
* - a vs_info_t - the temporary storage needed to process the request,
* - a vs_result_t - a place to store the scan result information to be
* returned to the caller.
*/
typedef struct vs_scan_ctx {
/* scan engine idx and connection info */
int vsc_idx;
int vsc_port;
int vsc_sockfd;
/* info about file to be scanned */
int vsc_fd;
char *vsc_fname;
int vsc_flags;
/* file to hold repaired data */
int vsc_repair_fd;
char *vsc_repair_fname;
/*
* vs_icap_hdr_t
*
* vs_icap.c defines tables of handlers for each ICAP OPTIONS RESPONSE HEADER
* and each ICAP RESPMOD RESPONSE HEADER which NAS AVA uses.
* Each entry in these tables is an vs_hdr_t.
*/
typedef struct vs_hdr {
int vsh_id;
char *vsh_name;
}vs_hdr_t;
/*
* vs_resp_msg_t
*
* vs_icap.c defines a table mapping ICAP response code values to text strings.
* Each entry in this tables is a vs_resp_msg_t.
*/
typedef struct vs_resp_msg {
int vsm_rc;
char *vsm_msg;
#ifdef __cplusplus
}
#endif
#endif /* _VS_ICAP_H_ */