166 lines
5.2 KiB
C
166 lines
5.2 KiB
C
/*
|
|
******************************************************************************
|
|
* INTERPEAK SOURCE FILE
|
|
*
|
|
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipfirewall_userdef_example.c,v $ $Revision: 1.17 $
|
|
* $Source: /home/interpeak/CVSRoot/ipfirewall/src/ipfirewall_userdef_example.c,v $
|
|
* $Author: markus $
|
|
* $State: Exp $ $Locker: $
|
|
*
|
|
* INTERPEAK_COPYRIGHT_STRING
|
|
* Design and implementation by Markus Carlstedt <markus@interpeak.se>
|
|
******************************************************************************
|
|
*/
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 1 DESCRIPTION
|
|
****************************************************************************
|
|
* User defined function example.
|
|
*/
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 2 CONFIGURATION
|
|
****************************************************************************
|
|
*/
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 3 INCLUDE FILES
|
|
****************************************************************************
|
|
*/
|
|
|
|
#define IPCOM_USE_CLIB_PROTO
|
|
#include <ipcom_type.h>
|
|
#include <ipcom_cstyle.h>
|
|
#include <ipcom_clib.h>
|
|
|
|
#define IPFIREWALL_C
|
|
#include "ipfirewall.h"
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 4 DEFINES
|
|
****************************************************************************
|
|
*/
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 5 TYPES
|
|
****************************************************************************
|
|
*/
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 6 EXTERN PROTOTYPES
|
|
****************************************************************************
|
|
*/
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 7 LOCAL PROTOTYPES
|
|
****************************************************************************
|
|
*/
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 8 DATA
|
|
****************************************************************************
|
|
*/
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 9 LOCAL FUNCTIONS
|
|
****************************************************************************
|
|
*/
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 10 GLOBAL FUNCTIONS
|
|
****************************************************************************
|
|
*/
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 11 PUBLIC FUNCTIONS
|
|
****************************************************************************
|
|
*/
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipfirewall_userdef_match
|
|
*===========================================================================
|
|
* Description: User defined match function example
|
|
* Parameters: pkt - pointer to the ipcom packet
|
|
* cookie - a cookie set at registration.
|
|
* info - user defined info buffer
|
|
* Returns: 1 = rule matched.
|
|
* 0 = rule did not match.
|
|
*
|
|
*/
|
|
IP_PUBLIC int
|
|
ipfirewall_userdef_match(Ipcom_pkt *pkt, void *cookie, void *info)
|
|
{
|
|
(void)pkt;
|
|
(void)cookie;
|
|
(void)info;
|
|
|
|
/* User code here */
|
|
|
|
if (ipcom_strcmp(info, "match") == 0)
|
|
return 1;
|
|
else
|
|
return 0;
|
|
}
|
|
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipfirewall_userdef_check
|
|
*===========================================================================
|
|
* Description: User defined check function example
|
|
* cookie - a cookie set at registration.
|
|
* info - parameter string specified in the rule syntax
|
|
* infolen - length of user defined info buffer
|
|
* Returns: 1 = rule parameters accepted
|
|
* 0 = rule parameters not accepted
|
|
*/
|
|
IP_PUBLIC int
|
|
ipfirewall_userdef_check(void *cookie, void *info, unsigned int infolen)
|
|
{
|
|
(void)cookie;
|
|
(void)info;
|
|
(void)infolen;
|
|
|
|
/* User code here */
|
|
|
|
return 1;
|
|
}
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipfirewall_userdef_destroy
|
|
*===========================================================================
|
|
* Description: User defined destroy function example
|
|
* cookie - a cookie set at registration.
|
|
* info - parameter string specified in the rule syntax
|
|
* infolen - length of user defined info buffer
|
|
*/
|
|
IP_PUBLIC void
|
|
ipfirewall_userdef_destroy(void *cookie, void *info, unsigned int infolen)
|
|
{
|
|
(void)cookie;
|
|
(void)info;
|
|
(void)infolen;
|
|
|
|
/* User code here */
|
|
}
|
|
|
|
|
|
/*
|
|
****************************************************************************
|
|
* END OF FILE
|
|
****************************************************************************
|
|
*/
|