sockfilter_impl.h revision 1a5e258f5471356ca102c7176637cdce45bac147
/*
* 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
*/
/*
*/
#ifndef _SOCKFS_SOCKFILTER_H
#define _SOCKFS_SOCKFILTER_H
#include <sys/socketvar.h>
#include <sys/sockfilter.h>
#ifdef __cplusplus
extern "C" {
#endif
struct sonode;
struct sockparams;
typedef struct sof_module sof_module_t;
typedef struct sof_entry_kstat sof_entry_kstat_t;
typedef struct sof_entry sof_entry_t;
typedef struct sof_instance sof_instance_t;
typedef struct sof_kstat sof_kstat_t;
#define SOF_MAXNAMELEN FILNAME_MAX
#define SOF_MAXSOCKTUPLECNT 32
#define SOF_MODPATH SOCKMOD_PATH
struct sof_module {
char *sofm_name;
};
struct sof_kstat {
};
#define SOF_GLOBAL_STAT_BUMP(s) \
/*
* Per filter statistics.
*/
struct sof_entry_kstat {
};
/*
* Socket filter entry - one for each configured filter (added and
* removed by soconfig(1M)).
*
* sofe_flags, sofe_refcnt and sofe_mod are protected by sofe_lock, and all
* other fields are write once.
*/
struct sof_entry {
char *sofe_hintarg; /* hint argument */
char sofe_flags; /* SOFEF_* flags */
};
/* Filter entry flags */
/*
* Socket filter instance - one for each socket using a sof_entry_t
*/
struct sof_instance {
void *sofi_cookie; /* filter cookie (from attach) */
char sofi_flags; /* instance flags (SOFIF_*) */
};
/* Filter instance flags */
#define SOF_STAT_ADD(i, s, v) \
extern void sof_init(void);
extern void sof_entry_free(sof_entry_t *);
extern int sof_entry_add(sof_entry_t *);
extern sof_entry_t *sof_entry_remove_by_name(const char *);
extern int sof_sockparams_init(struct sockparams *);
extern void sof_sockparams_fini(struct sockparams *);
extern void sof_sonode_closing(struct sonode *);
extern void sof_sonode_cleanup(struct sonode *);
struct cred *);
struct cred *);
extern int sof_rval2errno(sof_rval_t);
/*
* SOF_FILTER_OP traverses the filter stack for sonode `so' top-down,
* calling `op' for each filter with the supplied `args'. A non-negative
* return value indicates that a filter action was taken.
*/
sof_instance_t *__inst; \
sof_rval_t __rval; \
\
continue; \
(sof_rval_t), __rval); \
if (__rval != SOF_RVAL_CONTINUE) \
return (sof_rval2errno(__rval)); \
} \
return (-1);
extern int sof_filter_setsockopt(struct sonode *, int, int, void *,
extern int sof_filter_getsockopt(struct sonode *, int, int, void *,
#ifdef __cplusplus
}
#endif
#endif /* _SOCKFS_SOCKFILTER_H */