pfil.c revision ab25eeb551a4be927a4b6ae2cf8aff7ed17decb4
/*
* Copyright (C) 2000, 2003 by Darren Reed.
*
* See the IPFILTER.LICENCE file for details on licencing.
*
* ident "@(#)$Id: pfil.c,v 1.27 2003/11/30 09:45:57 darrenr Exp $"
*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef __hpux
#pragma ident "%Z%%M% %I% %E% SMI"
#else
struct uio;
#endif
#include <sys/byteorder.h>
#ifdef sun
#endif
#include <netinet/in_systm.h>
#ifdef sun
# if SOLARIS2 >= 8
# endif
#endif
#include "compat.h"
#include "qif.h"
#include "pfil.h"
int pfil_delayed_copy = 1;
int pfilinterface = PFIL_INTERFACE;
/*
** HPUX Port
** Align these structs to 16 bytes
** so that the embedded locks (first member)
** are 16 byte aligned
*/
#ifdef __hpux
#pragma align 16
#pragma align 16
#pragma align 16
#else
#endif
static int pfil_list_add(pfil_list_t *,
void *, mblk_t **)),
int);
static int pfil_list_remove(pfil_list_t *,
void *, mblk_t **)));
/* ------------------------------------------------------------------------ */
/* Function: pfil_report */
/* Returns: int - always returns 0 */
/* Parameters: q(I) - pointer to queue */
/* mp(I) - pointer to mblk */
/* arg(I) - pointer to value to retrieve */
/* cred(I) - pointer to credential information */
/* */
/* Returns a list of the registered callbacks for processing packets going */
/* in and out on a particular filtering head structure */
/* ------------------------------------------------------------------------ */
/*ARGSUSED*/
#else
/*ARGSUSED*/
#endif
{
(void *)p->pfil_func, p->pfil_flags);
(void *)p->pfil_func, p->pfil_flags);
return 0;
}
/* ------------------------------------------------------------------------ */
/* Function: pfil_init */
/* Returns: void */
/* Parameters: ph(I) - pointer to pfil head structure */
/* */
/* Initialise a pfil_head structure. */
/* ------------------------------------------------------------------------ */
void
{
#ifdef sun
#endif
#ifdef __hpux
#endif
}
/* ------------------------------------------------------------------------ */
/* Function: pfil_add_hook */
/* Returns: int - 0 == success, else error. */
/* Parameters: func(I) - function pointer to add */
/* flags(I) - flags describing for which events to call the */
/* passed function */
/* ph(I) - pointer to callback head structure */
/* */
/* This function is the public interface for adding a callback function to */
/* a list of callbacks for a particular protocol head (ph). */
/* */
/* pfil_add_hook() adds a function to the packet filter hook. the */
/* flags are: */
/* PFIL_IN call me on incoming packets */
/* PFIL_OUT call me on outgoing packets */
/* PFIL_WAITOK OK to call malloc and wait whilst adding this hook */
/* ------------------------------------------------------------------------ */
int
void *, mblk_t **));
int flags;
{
int err = 0;
return err;
}
/* ------------------------------------------------------------------------ */
/* Function: pfil_list_add */
/* Returns: int - 0 == success, else error. */
/* Parameters: list(I) - pfil list pointer */
/* func(I) - function pointer to add */
/* flags(I) - flags describing for which events to call the */
/* passed function */
/* Write Locks: list's owner */
/* */
/* Adds the function (func) to the end of the list of functions. */
/* ------------------------------------------------------------------------ */
static int
void *, mblk_t **));
int flags;
{
struct packet_filter_hook *pfh;
int wait;
return EEXIST;
return ENOMEM;
/*
* insert the input list in reverse order of the output list
* so that the hooks are called in the reverse order for each
* direction. So if it was A,B,C for input, it is C,B,A for output.
*/
}
return 0;
}
/* ------------------------------------------------------------------------ */
/* Function: pfil_remove_hook */
/* Returns: int - 0 == success, else error. */
/* Parameters: func(I) - function pointer to remove */
/* flags(I) - flags describing for which events to call the */
/* passed function */
/* ph(I) - pointer to callback head structure */
/* */
/* pfil_remove_hook removes a specific function from a particular */
/* pfil_head's list of callbacks as given by which flags have been passed. */
/* ------------------------------------------------------------------------ */
int
void *, mblk_t **));
int flags;
{
int err = 0;
return err;
}
/* ------------------------------------------------------------------------ */
/* Function: pfil_list_remove */
/* Returns: int - 0 == success, else error. */
/* Parameters: list(I) - pfil list pointer */
/* func(I) - function pointer to remove */
/* Write Locks: list's owner */
/* */
/* pfil_list_remove is an internal function that takes a function off the */
/* specified pfil list, providing that a match for func is found. */
/* ------------------------------------------------------------------------ */
static int
void *, mblk_t **));
{
struct packet_filter_hook *pfh;
return 0;
}
return ESRCH;
}
/* ------------------------------------------------------------------------ */
/* Function: pfil_hook_get */
/* Returns: struct packet_filter_hook * - pointer to first member in */
/* list of callbacks or NULL if */
/* if there are none. */
/* Parameters: flags(I) - indicates which callback list to return */
/* ph(I) - pointer to callback head structure */
/* Locks: READ(ph->ph_lock) */
/* */
/* Returns the first pointer of the list associated with "flags" or NULL if */
/* flags is not a recognised value. */
/* ------------------------------------------------------------------------ */
struct packet_filter_hook *
int flag;
{
/* ASSERT(rw_read_locked(&ph->ph_lock) != 0); */
switch (flag)
{
case PFIL_IN:
case PFIL_OUT:
}
}
return NULL;
}