⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ipsec_task_entry.c

📁 ipsec PNE 3.3 source code, running at more than vxworks6.x version.
💻 C
字号:
/* ipsec_task_entry.c - WindNet IPsec and IKE - Task init code                  *//*  * Copyright (c) 2000-2005 Wind River Systems, Inc.  *  * The right to copy, distribute, modify or otherwise make use  * of this software may be licensed only pursuant to the terms  * of an applicable Wind River license agreement.  *//* Copyright (c) 2002-2003 teamF1, Inc. *//* modification history--------------------02s,03jan06,rma  Reworked logic to remove RWOS dependency02r,28nov05,djp  replace WRN_INET with WRSEC_INET02q,26may05,rlm  Fixed ipsecDequeue() to pass packet's mbuf properly to                 ipsecReinsert(). Cleanup to remove some redundant local vars                 and moved some local vars outside of temp stack frames.02p,13apr05,djp  Fixed include paths02o,30nov04,jfb  Beautified again02n,29nov04,jfb  Beautified02m,02sep04,cdw  Modified sadb mutex usage02l,23aug04,rlm  Fixed potential NULL dereference in ipsecDequeue()                 (explicitly check for and drop packets with ip_v != IP_V4 or                 IP_V6)02k,15july2004,rma   added IPV6 support for ipsec_find_network_interface_based_on_ip_address()02j,28Apr2004,msa    Added semaphore to wait for initializations in spawned                     task. Changed modification history to new format.02i,05Aug03,rks(teamf1) added check for (p_ip_message != NULL) in ipsecDequeue            after ipsec_create_ip_vi_message.02h,12jun03,rparkhil added support for STACK_NAME02g,05jun03,mad(teamf1) added ifndef for IPV4_DUAL_STACK02f,24apr03,mad(teamf1) Modified to guard include file ipsec_ipv6_utilities.h            under ifdef __IPV6_STACK__02e,24Apr03,sam(teamf1) code cleanup.02d,24feb03,mad (teamf1)   replaced wrSecFree with wrSecFree in the function                             ipsecDequeue().02c,02Jan03,rks(teamf1): added code to convert datagram identifier to network                   format ( incase of non-CLarinet and INBOUND )02b,28Dec02,rks(teamf1): changes for supporting __IPSEC_QUEUING__02a,20Sep02,rks(teamf1): modification for IPv601a,19mar02,rpt   extracted from WindNet IPSec 1.1, added modification history*//******************************************************************************//* ipsecTaskEntry.c - entry point to initialize IPsec */#include <copyright_wrs.h>#include <stdio.h>#include <string.h>#include <vxWorks.h>#include <semLib.h>#include <taskLib.h>#include <netinet/in.h>#include "ipsecP.h"#include <wrn/ipsec/ipsecStats.h>#include "ipsec_class.h"#include "ipsec_globals.h"#include "ipsec_network_interface.h"#include "ipsec_print_routines.h"#include <wrn/ipsec/ipsecLogger.h>#include "ipsec_logger_util.h"#include "../common/wrSecTrace.h"#if STACK_NAME == STACK_NAME_V4_V6 && defined (INET6)#include "ipsec_ipv6_utilities.h"#endif /* STACK_NAME == STACK_NAME_V4_V6 && defined (INET6) */#if defined (__IPSEC_QUEUING__)#define IPSEC_QUEUE_MAX_TASKS 3             void ipsecDequeue(char *args){    IPSEC_QUEUE_MSG ipsec_queue_msg;	STATUS			status;    for (;;)    {		status = msgQReceive (ipsec_global_class.ipsecMsgQ, (char *)&ipsec_queue_msg, sizeof (IPSEC_QUEUE_MSG),WAIT_FOREVER);		if ( status != ERROR )        {            wrSecTrace( TRACE_IPSEC_IN | TRACE_IPSEC_OUT, L1, "Calling ipsecSecureAndReinsert() from within IPsec queue...\n");            ipsecSecureAndReinsert( ipsec_queue_msg.direction, ipsec_queue_msg.p_sa_bundle,                       &ipsec_queue_msg.p_memory_buffer, &ipsec_queue_msg.p_ip_header,                        ipsec_queue_msg.header_length );        }    }}#endif /* __IPSEC_QUEUING__ */STATUS ipsecTaskEntry(UINT task_priority){    STATUS status = OK;    int idx;/* Queuing*/#if !defined (__IPSEC_QUEUING__)    PARAMETER_NOT_USED (task_priority);    printf ("IPsec: Initialized. \r\n");#else    int ipsecMsgQSize = IFQ_MAXLEN;        ipsec_global_class.ipsecMsgQ = msgQCreate (ipsecMsgQSize, sizeof (IPSEC_QUEUE_MSG), MSG_Q_FIFO);    if (ipsec_global_class.ipsecMsgQ == NULL)    {        printf ("IPsec: Failed to create IPsec message queue\r\n");        return;    }    if ((task_priority > 51) || (task_priority == 0)) task_priority = 51;    for( idx = 0; idx < IPSEC_QUEUE_MAX_TASKS; idx++ )    {        status = taskSpawn( "tIPsec", (int)task_priority, 0, 20000, (FUNCPTR)ipsecDequeue,                    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL );        if (status == ERROR)            ipsec_printf (IPSEC_ERROR_PRINTF, "IPsec: tIPsec task failed to initialize.\n\r");    }   status = OK;#endif /* __IPSEC_QUEUING__ */    return (status);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -