当前位置: 首页>>代码示例>>C++>>正文


C++ DBGPRINT函数代码示例

本文整理汇总了C++中DBGPRINT函数的典型用法代码示例。如果您正苦于以下问题:C++ DBGPRINT函数的具体用法?C++ DBGPRINT怎么用?C++ DBGPRINT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了DBGPRINT函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: PrepareDownloadPacket

/******************************************************************************
 *
 *  Name: PrepareDownloadPacket()
 *
 *  Description: Prepare the DownloadPacket from packet send by upper layer
 *
 *  Conditions for Use:
 *
 *  Arguments:
 *      IN PMRVDRV_ADAPTER Adapter,
 *      IN PNDIS_PACKET Packet,
 *      IN PSDIO_TX_PKT pDnldPacket
 *    
 *  Return Value: None
 * 
 *  Notes:               
 *
 *****************************************************************************/
NDIS_STATUS PrepareDownloadPacket(PMRVDRV_ADAPTER Adapter,PNDIS_PACKET Packet, PSDIO_TX_PKT pDnldPacket)
{

  NDIS_STATUS  Status = NDIS_STATUS_SUCCESS;
  UINT BufferCount;
  UINT TotalPacketLength=0;
  UINT TotalBufferLength=0;
  UINT BytesCopied=0;
  UINT Length,AccumLength;
  PNDIS_BUFFER pBuffer, pNextBuffer;
  PVOID pVirtualAddr;
  PUCHAR pHeader = NULL;
  ULONG        coBufferLength = 0;
  ULONG i;
  PWCB    pWcb;
  UCHAR                   *pCurPtr = pDnldPacket->Buf.CmdBuf;

  Status = NDIS_STATUS_SUCCESS; 

  NdisQueryPacket(
    Packet,
    NULL,
    &BufferCount,
    &pBuffer,
    &TotalPacketLength);

  if(!pBuffer || !BufferCount || !TotalPacketLength)
  {
    Status=NDIS_STATUS_FAILURE; 

    DBGPRINT(DBG_TX|DBG_WARNING,(L"TX - NDIS buffer is not valid, return FAILURE \n"));  
    return Status;
  }
  //RETAILMSG(1,(TEXT("[Marvell]SendSinglePacket:1 NdisQueryBuffer")));
  NdisQueryBuffer(pBuffer, &pVirtualAddr, &Length);
  //RETAILMSG(1,(TEXT("[Marvell]SendSinglePacket:2 NdisQueryBuffer")));
  pHeader = (PUCHAR)pVirtualAddr;



  DBGPRINT(DBG_TX|DBG_HELP,(L"SendSinglePacket: buffers %d, packet len %d\n",BufferCount, TotalPacketLength));
  pWcb = (PWCB)&(pDnldPacket->Buf.TxDataBuf.Wcb);
  NdisZeroMemory(pWcb,sizeof(WCB));
  pWcb->Status =    MRVDRV_WCB_STATUS_USED;
  pWcb->PktLen = (USHORT)TotalPacketLength;
 
  DBGPRINT(DBG_TX|DBG_HELP,(L"DataRate = %x\n", (ULONG)Adapter -> DataRate));

    // number of retry is 3
//    pWcb->TxControl = ( (3 << 12 ) | Adapter->DataRate);
//    pWcb->TxControl =0;
    pWcb->TxControl = Adapter->TX_Control_Value; 
    pWcb->PktPtr = sizeof(WCB);
 
  
    //      First buffer contains the MAC header
    //      Call NdisMoveMemory() to copy DEST MAC adress to WCB
    //RETAILMSG(1,(TEXT("[Marvell]SendSinglePacket:1 NdisMoveMemory")));
    NdisMoveMemory(
                    (PVOID)&(pWcb->DestMACAdrHi),
                    pVirtualAddr, 
                    MRVDRV_ETH_ADDR_LEN);
   //RETAILMSG(1,(TEXT("[Marvell]SendSinglePacket:2 NdisMoveMemory")));

    {
        ULONG currenttime, packettime;
	
        currenttime = GetTickCount(); 
        packettime = *((ULONG *)(&Packet->MacReserved[0]));
        // PKtdelay in driver layer , unit 2ms
        pWcb->Reserved[0]=(UCHAR)((currenttime - packettime) / 2);
        DBGPRINT(DBG_CCX_V4,(L"PktDelay%02x ",pWcb->Reserved[0]));    
    }

  // Start the packet.
    TotalBufferLength = TotalPacketLength;
    TotalBufferLength += sizeof(WCB);


      
    // TotalBufferLength contains the size of the packet
    pDnldPacket->Len = ADD_SDIO_PKT_HDR_LENGTH(TotalBufferLength); 
//.........这里部分代码省略.........
开发者ID:HITEG,项目名称:TenByTen6410_SLC,代码行数:101,代码来源:txproc.c

示例2: RTMPCheckUcast

/*
    ==========================================================================
    Description:
       Check sanity of unicast cipher selector in RSN IE.
    Return:
         TRUE if match
         FALSE otherwise
    ==========================================================================
*/
BOOLEAN RTMPCheckUcast(
    IN PRTMP_ADAPTER    pAd,
    IN PEID_STRUCT      eid_ptr,
    IN MAC_TABLE_ENTRY	*pEntry)
{
	PUCHAR 	pStaTmp;
	USHORT	Count;
	UCHAR 	apidx;

	ASSERT(pEntry);
	ASSERT(pEntry->apidx < pAd->ApCfg.BssidNum);

	apidx = pEntry->apidx;

	pEntry->WepStatus = pAd->ApCfg.MBSSID[apidx].WepStatus;
    
	if (eid_ptr->Len < 16)
	{
		DBGPRINT(RT_DEBUG_ERROR, ("[ERROR]RTMPCheckUcast : the length is too short(%d) \n", eid_ptr->Len));
	    return FALSE;
	}	

	/* Store STA RSN_IE capability */
	pStaTmp = (PUCHAR)&eid_ptr->Octet[0];
	if(eid_ptr->Eid == IE_WPA2)
	{
		/* skip Version(2),Multicast cipter(4) 2+4==6 */
		/* point to number of unicast */
        pStaTmp +=6;
	}
	else if (eid_ptr->Eid == IE_WPA)	
	{
		/* skip OUI(4),Vesrion(2),Multicast cipher(4) 4+2+4==10 */
		/* point to number of unicast */
        pStaTmp += 10;
	}
	else
	{
		DBGPRINT(RT_DEBUG_ERROR, ("[ERROR]RTMPCheckUcast : invalid IE=%d\n", eid_ptr->Eid));
	    return FALSE;
	}

	/* Store unicast cipher count */
    NdisMoveMemory(&Count, pStaTmp, sizeof(USHORT));
    Count = cpu2le16(Count);		


	/* pointer to unicast cipher */
    pStaTmp += sizeof(USHORT);	
			
    if (eid_ptr->Len >= 16)
    {
    	if (eid_ptr->Eid == IE_WPA)
    	{
    		if (pAd->ApCfg.MBSSID[apidx].WepStatus == Ndis802_11Encryption4Enabled)
			{/* multiple cipher (TKIP/CCMP) */

				while (Count > 0)
				{
					/* TKIP */
					if (MIX_CIPHER_WPA_TKIP_ON(pAd->ApCfg.MBSSID[apidx].WpaMixPairCipher))
					{
						/* Compare if peer STA uses the TKIP as its unicast cipher */
					if (RTMPEqualMemory(pStaTmp, &pAd->ApCfg.MBSSID[apidx].RSN_IE[0][12], 4))
					{
						pEntry->WepStatus = Ndis802_11Encryption2Enabled;
						return TRUE;
					}

						/* Our AP uses the AES as the secondary cipher */
						/* Compare if the peer STA use AES as its unicast cipher */
						if (MIX_CIPHER_WPA_AES_ON(pAd->ApCfg.MBSSID[apidx].WpaMixPairCipher))
						{
							if (RTMPEqualMemory(pStaTmp, &pAd->ApCfg.MBSSID[apidx].RSN_IE[0][16], 4))
							{
								pEntry->WepStatus = Ndis802_11Encryption3Enabled;
								return TRUE;
							}
						}
					}
					else
					{
					/* AES */
						if (RTMPEqualMemory(pStaTmp, &pAd->ApCfg.MBSSID[apidx].RSN_IE[0][12], 4))
					{
						pEntry->WepStatus = Ndis802_11Encryption3Enabled;
						return TRUE;
					}
					}
															
					pStaTmp += 4;
//.........这里部分代码省略.........
开发者ID:32743069,项目名称:amlogic_common_3050,代码行数:101,代码来源:ap_wpa.c

示例3: APValidateRSNIE

/*
    ==========================================================================
    Description:
       Check validity of the received RSNIE.

    Return:
		status code
    ==========================================================================
*/
UINT	APValidateRSNIE(
	IN PRTMP_ADAPTER    pAd,
	IN PMAC_TABLE_ENTRY pEntry,
	IN PUCHAR			pRsnIe,
	IN UCHAR			rsnie_len)
{
	UINT StatusCode = MLME_SUCCESS;
	PEID_STRUCT  eid_ptr;
	int	apidx;
	PMULTISSID_STRUCT pMbss;

	if (rsnie_len == 0)
		return MLME_SUCCESS;

	eid_ptr = (PEID_STRUCT)pRsnIe;
	if ((eid_ptr->Len + 2) != rsnie_len)
	{
		DBGPRINT(RT_DEBUG_ERROR, ("[ERROR]APValidateRSNIE : the len is invalid !!!\n"));
		return MLME_UNSPECIFY_FAIL;
	}

	apidx = pEntry->apidx;
	pMbss = &pAd->ApCfg.MBSSID[apidx];

#ifdef WAPI_SUPPORT
	if (eid_ptr->Eid == IE_WAPI)	
		return MLME_SUCCESS;
#endif /* WAPI_SUPPORT */

	/* check group cipher */
	if (!RTMPCheckMcast(pAd, eid_ptr, pEntry))
	{
		DBGPRINT(RT_DEBUG_ERROR, ("[ERROR]APValidateRSNIE : invalid group cipher !!!\n"));	    
	    StatusCode = MLME_INVALID_GROUP_CIPHER;
	}  
	/* Check pairwise cipher */
	else if (!RTMPCheckUcast(pAd, eid_ptr, pEntry))
	{
		DBGPRINT(RT_DEBUG_ERROR, ("[ERROR]APValidateRSNIE : invalid pairwise cipher !!!\n"));	    
	    StatusCode = MLME_INVALID_PAIRWISE_CIPHER;
	}        
	/* Check AKM */
	else if (!RTMPCheckAUTH(pAd, eid_ptr, pEntry))
	{
	    DBGPRINT(RT_DEBUG_ERROR, ("[ERROR]APValidateRSNIE : invalid AKM !!!\n"));
	    StatusCode = MLME_INVALID_AKMP;
	}                        

	if (StatusCode != MLME_SUCCESS)
	{
		/* send wireless event - for RSN IE sanity check fail */
		RTMPSendWirelessEvent(pAd, IW_RSNIE_SANITY_FAIL_EVENT_FLAG, pEntry->Addr, 0, 0);
		DBGPRINT(RT_DEBUG_ERROR, ("%s : invalid status code(%d) !!!\n", __FUNCTION__, StatusCode));
	}
	else
	{
        UCHAR CipherAlg = CIPHER_NONE;
		
        if (pEntry->WepStatus == Ndis802_11Encryption1Enabled)
            CipherAlg = CIPHER_WEP64;
        else if (pEntry->WepStatus == Ndis802_11Encryption2Enabled)
            CipherAlg = CIPHER_TKIP;
        else if (pEntry->WepStatus == Ndis802_11Encryption3Enabled)
            CipherAlg = CIPHER_AES;
        DBGPRINT(RT_DEBUG_TRACE, ("%s : (AID#%d WepStatus=%s)\n", __FUNCTION__, pEntry->Aid, CipherName[CipherAlg]));
	}

	
	
	return StatusCode;

}
开发者ID:32743069,项目名称:amlogic_common_3050,代码行数:81,代码来源:ap_wpa.c

示例4: ndisMOpenAdapter


//.........这里部分代码省略.........

			//
			//  Initialize the send handler.
			//
			switch (Miniport->MediaType)
			{
				case NdisMediumArcnet878_2:

					FakeMac->MacCharacteristics.SendHandler = ndisMArcnetSend;
					break;

				case NdisMediumWan:

					FakeMac->MacCharacteristics.SendHandler = (PVOID)ndisMWanSend;
					break;

				default:
					//
					//   If this is a fullduplex miniport then change the reset handler.
					//
					if (MINIPORT_TEST_FLAG(Miniport, fMINIPORT_FULL_DUPLEX))
					{
						FakeMac->MacCharacteristics.ResetHandler = ndisMResetFullDuplex;
					}

					//
					//	Set up the send packet handlers miniports that support
					//	the new NDIS 4.0 SendPackets handler.
					//
					if (MINIPORT_TEST_SEND_FLAG(Miniport, fMINIPORT_SEND_PACKET_ARRAY))
					{
						if (MINIPORT_TEST_FLAG(Miniport, fMINIPORT_FULL_DUPLEX))
						{
							DBGPRINT(DBG_COMP_SEND, DBG_LEVEL_INFO,
								("Using ndisMSendFullDuplexToSendPackets\n"));
							FakeMac->MacCharacteristics.SendHandler = ndisMSendFullDuplexToSendPackets;
						}
						else
						{
							DBGPRINT(DBG_COMP_SEND, DBG_LEVEL_INFO,
								("Using ndisMSendToSendPackets\n"));
							FakeMac->MacCharacteristics.SendHandler = ndisMSendToSendPackets;
						}
					}
					else
					{
						if (MINIPORT_TEST_FLAG(Miniport, fMINIPORT_FULL_DUPLEX))
						{
							DBGPRINT(DBG_COMP_SEND, DBG_LEVEL_INFO,
								("Using ndisMSendFullDuplex\n"));
							FakeMac->MacCharacteristics.SendHandler = ndisMSendFullDuplex;
						}
						else
						{
							DBGPRINT(DBG_COMP_SEND, DBG_LEVEL_INFO,
								("Using ndisMSend\n"));
							FakeMac->MacCharacteristics.SendHandler = ndisMSend;
						}
					}
					break;
			}   

			//
			//  If the miniport indicates packets the we have a dummy
			//  transfer data.
			//
开发者ID:BillTheBest,项目名称:WinNT4,代码行数:67,代码来源:configm.c

示例5: RTMPGetTxTscFromAsic

VOID RTMPGetTxTscFromAsic(
	IN  PRTMP_ADAPTER   pAd,
	IN	UCHAR			apidx,
	OUT	PUCHAR			pTxTsc)
{
	USHORT			Wcid;
	USHORT			offset;
	UCHAR			IvEiv[8];
	int				i;

	/* Sanity check of apidx */
	if (apidx >= MAX_MBSSID_NUM(pAd))
	{
		DBGPRINT(RT_DEBUG_ERROR, ("RTMPGetTxTscFromAsic : invalid apidx(%d)\n", apidx));
		return;
	}

	/* Initial value */
	NdisZeroMemory(IvEiv, 8);
	NdisZeroMemory(pTxTsc, 6);

	/* Get apidx for this BSSID */
	GET_GroupKey_WCID(pAd, Wcid, apidx);	

	/* When the group rekey action is triggered, a count-down(3 seconds) is started. 
	   During the count-down, use the initial PN as TSC.
	   Otherwise, get the IVEIV from ASIC. */
	if (pAd->ApCfg.MBSSID[apidx].RekeyCountDown > 0)
	{
		/*
		In IEEE 802.11-2007 8.3.3.4.3 described :
		The PN shall be implemented as a 48-bit monotonically incrementing
		non-negative integer, initialized to 1 when the corresponding 
		temporal key is initialized or refreshed. */	
		IvEiv[0] = 1;
	}
	else
	{
		UINT32 temp1, temp2;
		/* Read IVEIV from Asic */
		offset = MAC_IVEIV_TABLE_BASE + (Wcid * HW_IVEIV_ENTRY_SIZE);
		
		/* Use Read32 to avoid endian problem */
		RTMP_IO_READ32(pAd, offset, &temp1);
		RTMP_IO_READ32(pAd, offset+4, &temp2);
		for ( i=0; i<4; i++)
		{
			IvEiv[i] = (UCHAR)(temp1 >> (i*8));
			IvEiv[i+4] = (UCHAR)(temp2 >> (i*8));
		}
	}

	/* Record current TxTsc */
	if (pAd->ApCfg.MBSSID[apidx].GroupKeyWepStatus == Ndis802_11Encryption3Enabled)
	{	/* AES */
		*pTxTsc 	= IvEiv[0];
		*(pTxTsc+1) = IvEiv[1];
		*(pTxTsc+2) = IvEiv[4];
		*(pTxTsc+3) = IvEiv[5];
		*(pTxTsc+4) = IvEiv[6];
		*(pTxTsc+5) = IvEiv[7];					
	}
	else
	{	/* TKIP */
		*pTxTsc 	= IvEiv[2];
		*(pTxTsc+1) = IvEiv[0];
		*(pTxTsc+2) = IvEiv[4];
		*(pTxTsc+3) = IvEiv[5];
		*(pTxTsc+4) = IvEiv[6];
		*(pTxTsc+5) = IvEiv[7];	
	}
	DBGPRINT(RT_DEBUG_TRACE, ("RTMPGetTxTscFromAsic : WCID(%d) TxTsc 0x%02x-0x%02x-0x%02x-0x%02x-0x%02x-0x%02x \n", 
									Wcid, *pTxTsc, *(pTxTsc+1), *(pTxTsc+2), *(pTxTsc+3), *(pTxTsc+4), *(pTxTsc+5)));
			

}
开发者ID:32743069,项目名称:amlogic_common_3050,代码行数:76,代码来源:ap_wpa.c

示例6: DBGPRINT

int WirelessProtocol::sendData(byte* data, uint16_t size, uint64_t Pipe, uint16_t SendTimeout)
{
	ProtocolMessage PM;

	if (size % 30 == 0)
		PM.AllLength = size / 30;
	else
		PM.AllLength = size / 30 + 1;

	radio->stopListening();
	radio->openWritingPipe(Pipe);


	DBGPRINT("Send data size: %hu, package count: %hu", size, PM.AllLength);

	unsigned long lastSuccSend = millis();

	for (uint8_t i = 0; i < PM.AllLength; i++)
	{
		if (millis() - lastSuccSend > SendTimeout)
		{
			DBGPRINT("All send timeout");
			return ERROR_TIMEOUT;
		}

		DBGPRINT("Trying send package: %hu", i);
		PM.CurrentNum = i;
		memcpy(PM.data, &(data[i*30]), min(30, size - 30*i));
		bin_dump((char *)(PM.data), 30);
		radio->write(&PM, sizeof(ProtocolMessage));
		long wait_start = millis();

		bool ackR = false;
		while ( !(ackR = radio->available()) && (millis() - wait_start) < PACKET_TIMEOUT)
		{
			radio->stopListening();
			radio->write(&PM, sizeof(ProtocolMessage));
			radio->startListening();
			delay(30);
		}
			
	
		if (ackR)
		{
			uint8_t message_count;
			radio->read(&message_count,sizeof(message_count));
			DBGPRINT("Reciving ack package %hu", message_count);
			if (message_count != i)
			{
				DBGPRINT("Failed send package: %hu", i);
				i--;
			}
			else
			{
				DBGPRINT("Packet send");
				lastSuccSend = millis();
			}
		}
		else
		{
			DBGPRINT("Timeout sending package: %hu", i);
			i--;
		}
	}



	DBGPRINT("Send complete");



	return ERROR_SUCCESS;
}
开发者ID:ArduinoBazar,项目名称:CryptoProtocol,代码行数:73,代码来源:WirelessProtocol.cpp

示例7: NdisMDeregisterIoPortRange

VOID
NdisMDeregisterIoPortRange(
	IN	NDIS_HANDLE				MiniportAdapterHandle,
	IN	UINT					InitialPort,
	IN	UINT					NumberOfPorts,
	IN	PVOID					PortOffset
	)

/*++

Routine Description:

	Sets up an IO port for operations.

Arguments:

	MiniportAdapterHandle - Handle passed to Miniport Initialize.

	InitialPort - Physical address of the starting port number.

	NumberOfPorts - Number of ports to map.

	PortOffset - The mapped port address the Miniport uses for NdisRaw functions.

Return Value:

	None.

--*/
{
	PNDIS_MINIPORT_BLOCK Miniport = (PNDIS_MINIPORT_BLOCK)(MiniportAdapterHandle);
	PHYSICAL_ADDRESS PortAddress;
	PHYSICAL_ADDRESS InitialPortAddress;
	ULONG addressSpace;
	CM_PARTIAL_RESOURCE_DESCRIPTOR	Resource;
	NDIS_STATUS	Status;

	//
	// Get the system physical address for this card.  The card uses
	// I/O space, except for "internal" Jazz devices which use
	// memory space.
	//
	addressSpace = (Miniport->AdapterType == NdisInterfaceInternal) ? 0 : 1;

	InitialPortAddress.LowPart = InitialPort;
	InitialPortAddress.HighPart = 0;

	HalTranslateBusAddress(Miniport->BusType,		// InterfaceType
						   Miniport->BusNumber,		// BusNumber
                           InitialPortAddress,		// Bus Address
						   &addressSpace,			// AddressSpace
						   &PortAddress);			// Translated address
	if (addressSpace == 0)
	{
		//
		// memory space
		//
		MmUnmapIoSpace(PortOffset, NumberOfPorts);
	}

	//
	//	Build the resource to remove.
	//
	Resource.Type = CmResourceTypePort;
	Resource.ShareDisposition = CmResourceShareDeviceExclusive;
	Resource.Flags = (Miniport->AdapterType == NdisInterfaceInternal) ?
						CM_RESOURCE_PORT_MEMORY : CM_RESOURCE_PORT_IO;
	Resource.u.Port.Start.QuadPart = InitialPort;
	Resource.u.Port.Length = NumberOfPorts;

	//
	//	Remove the resource.
	//
	Status = ndisRemoveResource(
				&Miniport->Resources,
				&Resource,
				Miniport->DriverHandle->NdisDriverInfo->NdisWrapperDriver,
				Miniport->DeviceObject,
				&Miniport->MiniportName);

	if (Status != NDIS_STATUS_SUCCESS)
	{
		DBGPRINT(DBG_COMP_UNLOAD, DBG_LEVEL_INFO,
			("NdisMDeregisterIoPortRange failed to remove the resource\n"));
	}
}
开发者ID:BillTheBest,项目名称:WinNT4,代码行数:86,代码来源:configm.c

示例8: MATEngineTxHandle

/*
	========================================================================
	Routine	Description:
		For each out-going packet, check the upper layer protocol type if need
		to handled by our APCLI convert engine. If yes, call corresponding handler 
		to handle it.
		
	Arguments:
		pAd		=>Pointer to our adapter
		pPkt 	=>pointer to the 802.11 header of outgoing packet 
		ifIdx   =>Interface Index want to dispatch to.

	Return Value:
		Success	=>
			TRUE
			Mapped mac address if found, else return specific default mac address 
			depends on the upper layer protocol type.
		Error	=>
			FALSE.

	Note:
		1.the pPktHdr must be a 802.3 packet.
		2.Maybe we need a TxD arguments?
		3.We check every packet here including group mac address becasue we need to
		  handle DHCP packet.
	========================================================================
 */
PUCHAR MATEngineTxHandle(
	IN PRTMP_ADAPTER	pAd,
	IN PNDIS_PACKET	    pPkt,
	IN UINT				ifIdx,
	IN UCHAR    OpMode)
{
	PUCHAR 		pLayerHdr = NULL, pPktHdr = NULL,  pMacAddr = NULL;
	UINT16		protoType, protoType_ori;
	INT			i;
	struct _MATProtoOps 	*pHandle = NULL;
	PUCHAR  retSkb = NULL;
	BOOLEAN bVLANPkt = FALSE;


	if(pAd->MatCfg.status != MAT_ENGINE_STAT_INITED)
		return NULL;
	
	pPktHdr = GET_OS_PKT_DATAPTR(pPkt);
	if (!pPktHdr)
		return NULL;
	
	protoType_ori = get_unaligned((PUINT16)(pPktHdr + 12));
	
	/* Get the upper layer protocol type of this 802.3 pkt. */
	protoType = OS_NTOHS(protoType_ori);

	/* handle 802.1q enabled packet. Skip the VLAN tag field to get the protocol type. */
	if (protoType == 0x8100)
	{
		protoType_ori = get_unaligned((PUINT16)(pPktHdr + 12 + 4));
		protoType = OS_NTOHS(protoType_ori);
		bVLANPkt = TRUE;
	}

	
#ifdef RELEASE_EXCLUDE
	DBGPRINT(RT_DEBUG_INFO,("%s(): protoType=0x%04x\n", __FUNCTION__, protoType));
#endif /* RELEASE_EXCLUDE */
	/* For differnet protocol, dispatch to specific handler */
	for (i=0; i < MAX_MAT_SUPPORT_PROTO_NUM; i++)
	{
		if (protoType == MATProtoTb[i].protocol)
		{
			pHandle = MATProtoTb[i].pHandle;	/* the pHandle must not be null! */
			pLayerHdr = bVLANPkt ? (pPktHdr + MAT_VLAN_ETH_HDR_LEN) : (pPktHdr + MAT_ETHER_HDR_LEN);
#ifdef CONFIG_AP_SUPPORT
#ifdef APCLI_SUPPORT
			IF_DEV_CONFIG_OPMODE_ON_AP(pAd)
			{
#ifdef MAC_REPEATER_SUPPORT
				UCHAR tempIdx = ifIdx;
				UCHAR CliIdx = 0xFF;

				if (tempIdx >= 64)
				{
					CliIdx = ((tempIdx - 64) % 16);
					tempIdx = ((tempIdx - 64) / 16);

					pMacAddr = &pAd->ApCfg.ApCliTab[tempIdx].RepeaterCli[CliIdx].CurrentAddress[0];
				}
				else
#endif /* MAC_REPEATER_SUPPORT */
					pMacAddr = &pAd->ApCfg.ApCliTab[ifIdx].wdev.if_addr[0];
			}
#endif /* APCLI_SUPPORT */
#endif /* CONFIG_AP_SUPPORT */

#ifdef CONFIG_STA_SUPPORT
#ifdef ETH_CONVERT_SUPPORT
#ifdef P2P_SUPPORT
			if (OpMode == OPMODE_STA)
				pMacAddr = &pAd->CurrentAddress[0];
#ifdef APCLI_SUPPORT
//.........这里部分代码省略.........
开发者ID:vm3vuy,项目名称:my-local-repository,代码行数:101,代码来源:cmm_mat.c

示例9: NdisAcquireSpinLock

MAC_TABLE_ENTRY *MacTableInsertEntry(
	IN  PRTMP_ADAPTER   pAd,
	IN  PUCHAR			pAddr,
	IN	UCHAR			apidx,
	IN	UCHAR			OpMode,
	IN BOOLEAN	CleanAll)
{
	UCHAR HashIdx;
	int i, FirstWcid;
	MAC_TABLE_ENTRY *pEntry = NULL, *pCurrEntry;
/*	USHORT	offset;*/
/*	ULONG	addr;*/
	BOOLEAN Cancelled;

	/* if FULL, return*/
	if (pAd->MacTab.Size >= MAX_LEN_OF_MAC_TABLE)
		return NULL;

		FirstWcid = 1;


	/* allocate one MAC entry*/
	NdisAcquireSpinLock(&pAd->MacTabLock);
	for (i = FirstWcid; i< MAX_LEN_OF_MAC_TABLE; i++)   /* skip entry#0 so that "entry index == AID" for fast lookup*/
	{
		/* pick up the first available vacancy*/
		if (IS_ENTRY_NONE(&pAd->MacTab.Content[i]))
		{
			pEntry = &pAd->MacTab.Content[i];

			/* ENTRY PREEMPTION: initialize the entry */
			RTMPCancelTimer(&pEntry->RetryTimer, &Cancelled);
			RTMPCancelTimer(&pEntry->EnqueueStartForPSKTimer, &Cancelled);

			NdisZeroMemory(pEntry, sizeof(MAC_TABLE_ENTRY));

			if (CleanAll == TRUE)
			{
				pEntry->MaxSupportedRate = RATE_11;
				pEntry->CurrTxRate = RATE_11;
				NdisZeroMemory(pEntry, sizeof(MAC_TABLE_ENTRY));
				pEntry->PairwiseKey.KeyLen = 0;
				pEntry->PairwiseKey.CipherAlg = CIPHER_NONE;
			}

			do
			{


#ifdef CONFIG_AP_SUPPORT
#ifdef APCLI_SUPPORT
					if (apidx >= MIN_NET_DEVICE_FOR_APCLI)
					{
						SET_ENTRY_APCLI(pEntry);
						pEntry->isCached = FALSE;
						break;
					}
#endif /* APCLI_SUPPORT */
#ifdef WDS_SUPPORT
					if (apidx >= MIN_NET_DEVICE_FOR_WDS)
					{
						SET_ENTRY_WDS(pEntry);
						pEntry->isCached = FALSE;
						break;
					}
#endif /* WDS_SUPPORT */
#endif /* CONFIG_AP_SUPPORT */

#ifdef CONFIG_AP_SUPPORT
					IF_DEV_CONFIG_OPMODE_ON_AP(pAd)
					{	/* be a regular-entry*/
						if ((apidx < pAd->ApCfg.BssidNum) &&
							(apidx < MAX_MBSSID_NUM(pAd)) &&
							((apidx < HW_BEACON_MAX_NUM)) &&
							(pAd->ApCfg.MBSSID[apidx].MaxStaNum != 0) &&
							(pAd->ApCfg.MBSSID[apidx].StaCount >= pAd->ApCfg.MBSSID[apidx].MaxStaNum))
						{
							DBGPRINT(RT_DEBUG_WARN, ("%s: The connection table is full in ra%d.\n", __FUNCTION__, apidx));
							NdisReleaseSpinLock(&pAd->MacTabLock);
							return NULL;
						}
				}
#endif /* CONFIG_AP_SUPPORT */
						SET_ENTRY_CLIENT(pEntry);

		} while (FALSE);

			pEntry->bIAmBadAtheros = FALSE;

			RTMPInitTimer(pAd, &pEntry->EnqueueStartForPSKTimer, GET_TIMER_FUNCTION(EnqueueStartForPSKExec), pEntry, FALSE);


#ifdef CONFIG_AP_SUPPORT
			IF_DEV_CONFIG_OPMODE_ON_AP(pAd)
			{
				if (IS_ENTRY_CLIENT(pEntry)) /* Only Clent entry need the retry timer.*/
				{
					RTMPInitTimer(pAd, &pEntry->RetryTimer, GET_TIMER_FUNCTION(WPARetryExec), pEntry, FALSE);

	/*				RTMP_OS_Init_Timer(pAd, &pEntry->RetryTimer, GET_TIMER_FUNCTION(WPARetryExec), pAd);*/
//.........这里部分代码省略.........
开发者ID:andyvand,项目名称:mt7601u-ap,代码行数:101,代码来源:mgmt_entrytb.c

示例10: me2fsGetAcl

//static int me2fsCreate( struct inode *inode, struct dentry *dir,
//						umode_t mode, bool flag )
//{ DBGPRINT( "<ME2FS>inode ops:create!\n" ); return 0; }
//static int me2fsLink( struct dentry *dentry, struct inode *inode, struct dentry *d)
//{ DBGPRINT( "<ME2FS>inode ops:link!\n" ); return 0; }
//static int me2fsUnlink( struct inode *inode, struct dentry *d )
//{ DBGPRINT( "<ME2FS>inode ops:unlink!\n" ); return 0; }
//static int me2fsSymlink( struct inode *inode, struct dentry *d, const char *name )
//{ DBGPRINT( "<ME2FS>inode ops:symlink!\n" ); return 0; }
//static int me2fsMkdir( struct inode *inode, struct dentry *d, umode_t mode )
//{ DBGPRINT( "<ME2FS>inode ops:mkdir!\n" ); return 0; }
//static int me2fsRmdir( struct inode *inode, struct dentry *d )
//{ DBGPRINT( "<ME2FS>inode ops:rmdir!\n" ); return 0; }
//static int me2fsMknod( struct inode *inode, struct dentry *d,
//					umode_t mode, dev_t dev )
//{ DBGPRINT( "<ME2FS>inode ops:mknod!\n" ); return 0; }
//static int me2fsRename( struct inode *inode, struct dentry *d,
//					struct inode *inode2, struct dentry *d2 )
//{ DBGPRINT( "<ME2FS>inode ops:rename!\n" ); return 0; }
//static int me2fsSetAttr( struct dentry *dentry, struct iattr *attr )
//{ DBGPRINT( "<ME2FS>inode ops:setattr!\n" ); return 0; }
static struct posix_acl* me2fsGetAcl( struct inode *inode, int flags )
{ DBGPRINT( "<ME2FS>inode ops:get_acl!\n" ); return 0; }
开发者ID:KnightSch,项目名称:Learning-Ext2-Filesystem,代码行数:23,代码来源:me2fs_namei.c

示例11: me2fsMkdir

/*
==================================================================================
	Function	:me2fsMkdir
	Input		:struct inode *dir
				 < vfs inode of directory >
				 struct dentry *dentry
				 < dentry to be made its entry >
				 umode_t mode
				 < file mode >
	Output		:void
	Return		:int
				 < result >

	Description	:make a directory in *dir
==================================================================================
*/
static int
me2fsMkdir( struct inode *dir, struct dentry *dentry, umode_t mode )
{
	struct inode	*inode;
	int				err;

#if 0	// quota
	dquot_initialize( dir );
#endif

	DBGPRINT( "<ME2FS>mkdir : start make [%s]\n", dentry->d_name.name );

	/* ------------------------------------------------------------------------ */
	/* allocate a new inode for new directory									*/ 
	/* ------------------------------------------------------------------------ */
	inode_inc_link_count( dir );
	inode = me2fsAllocNewInode( dir, S_IFDIR | mode, &dentry->d_name );

	if( IS_ERR( inode ) )
	{
		inode_dec_link_count( dir );
		return( PTR_ERR( inode ) );
	}

	inode->i_op				= &me2fs_dir_inode_operations;
	inode->i_fop			= &me2fs_dir_operations;
	inode->i_mapping->a_ops	= &me2fs_aops;

	/* ------------------------------------------------------------------------ */
	/* make empty directory( just make '.')										*/
	/* ------------------------------------------------------------------------ */
	inode_inc_link_count( inode );

	if( ( err = me2fsMakeEmpty( inode, dir ) ) )
	{
		goto out_fail;
	}

	/* ------------------------------------------------------------------------ */
	/* insert the new directory's inode to its parent							*/
	/* ------------------------------------------------------------------------ */
	if( ( err = me2fsAddLink( dentry, inode ) ) )
	{
		goto out_fail;
	}

	unlock_new_inode( inode );
	d_instantiate( dentry, inode );

	DBGPRINT( "<ME2FS>mkdir : complete [%s]\n", dentry->d_name.name );

	return( err );

out_fail:
	DBGPRINT( "<ME2FS>failed to make dir\n" );
	inode_dec_link_count( inode );
	inode_dec_link_count( inode );
	unlock_new_inode( inode );
	iput( inode );

	return( err );
}
开发者ID:KnightSch,项目名称:Learning-Ext2-Filesystem,代码行数:78,代码来源:me2fs_namei.c

示例12: APPeerAuthConfirmAction

static VOID APPeerAuthConfirmAction(
	IN struct rtmp_adapter *pAd,
	IN MLME_QUEUE_ELEM *Elem)
{
	unsigned short          Seq, Alg, Status;
	u8           Addr2[MAC_ADDR_LEN];
	PHEADER_802_11  pRcvHdr;
	CHAR            Chtxt[CIPHER_TEXT_LEN];
	MAC_TABLE_ENTRY *pEntry;
	u8 		Addr1[MAC_ADDR_LEN];
	uint32_t 		apidx;




	if (! APPeerAuthSanity(pAd, Elem->Msg, Elem->MsgLen, Addr1,
							Addr2, &Alg, &Seq, &Status, Chtxt
		))
		return;

	apidx = get_apidx_by_addr(pAd, Addr1);
	if (apidx >= pAd->ApCfg.BssidNum)
	{
		DBGPRINT(RT_DEBUG_TRACE, ("AUTH - Bssid not found\n"));
		return;
	}

	if ((pAd->ApCfg.MBSSID[apidx].wdev.if_dev != NULL) &&
		!(RTMP_OS_NETDEV_STATE_RUNNING(pAd->ApCfg.MBSSID[apidx].wdev.if_dev)))
	{
    	DBGPRINT(RT_DEBUG_TRACE, ("AUTH - Bssid IF didn't up yet.\n"));
	   	return;
	} /* End of if */

	if (Elem->Wcid >= MAX_LEN_OF_MAC_TABLE)
	{
    	DBGPRINT(RT_DEBUG_ERROR, ("AUTH - Invalid wcid (%d).\n", Elem->Wcid));
		return;
	}

	pEntry = &pAd->MacTab.Content[Elem->Wcid];
	if (pEntry && IS_ENTRY_CLIENT(pEntry))
	{
		if (!RTMPEqualMemory(Addr1, pAd->ApCfg.MBSSID[pEntry->apidx].wdev.bssid, MAC_ADDR_LEN))
		{
			MacTableDeleteEntry(pAd, pEntry->wcid, pEntry->Addr);
			pEntry = NULL;
			DBGPRINT(RT_DEBUG_WARN, ("AUTH - Bssid does not match\n"));
		}
		else
		{
			if (pEntry->bIAmBadAtheros == true)
			{
				AsicUpdateProtect(pAd, 8, ALLN_SETPROTECT, false, false);
				DBGPRINT(RT_DEBUG_TRACE, ("Atheros Problem. Turn on RTS/CTS!!!\n"));
				pEntry->bIAmBadAtheros = false;
			}

			ASSERT(pEntry->Aid == Elem->Wcid);

			BASessionTearDownALL(pAd, pEntry->wcid);
		}
	}

    pRcvHdr = (PHEADER_802_11)(Elem->Msg);

	DBGPRINT(RT_DEBUG_TRACE,
			("AUTH - MBSS(%d), Rcv AUTH seq#%d, Alg=%d, Status=%d from "
			"[wcid=%d]%02x:%02x:%02x:%02x:%02x:%02x\n",
			apidx, Seq, Alg, Status, Elem->Wcid, PRINT_MAC(Addr2)));

	if (pEntry && MAC_ADDR_EQUAL(Addr2, pAd->ApMlmeAux.Addr))
	{
		if ((pRcvHdr->FC.Wep == 1) &&
			NdisEqualMemory(Chtxt, pAd->ApMlmeAux.Challenge, CIPHER_TEXT_LEN))
		{
			/* Successful */
			APPeerAuthSimpleRspGenAndSend(pAd, pRcvHdr, Alg, Seq + 1, MLME_SUCCESS);
			pEntry->AuthState = AS_AUTH_KEY;
			pEntry->Sst = SST_AUTH;
		}
		else
		{

			/* send wireless event - Authentication rejected because of challenge failure */
			RTMPSendWirelessEvent(pAd, IW_AUTH_REJECT_CHALLENGE_FAILURE, pEntry->Addr, 0, 0);

			/* fail - wep bit is not set or challenge text is not equal */
			APPeerAuthSimpleRspGenAndSend(pAd, pRcvHdr, Alg, Seq + 1, MLME_REJ_CHALLENGE_FAILURE);
			MacTableDeleteEntry(pAd, pEntry->wcid, pEntry->Addr);

			/*Chtxt[127]='\0'; */
			/*pAd->ApMlmeAux.Challenge[127]='\0'; */
			DBGPRINT(RT_DEBUG_TRACE, ("%s\n",
						((pRcvHdr->FC.Wep == 1) ? "challenge text is not equal" : "wep bit is not set")));
			/*DBGPRINT(RT_DEBUG_TRACE, ("Sent Challenge = %s\n",&pAd->ApMlmeAux.Challenge[100])); */
			/*DBGPRINT(RT_DEBUG_TRACE, ("Rcv Challenge = %s\n",&Chtxt[100])); */
		}
	}
	else
//.........这里部分代码省略.........
开发者ID:ulli-kroll,项目名称:mt7612u,代码行数:101,代码来源:ap_auth.c

示例13: APPeerAuthReqAtIdleAction

static VOID APPeerAuthReqAtIdleAction(
	IN struct rtmp_adapter *pAd,
	IN MLME_QUEUE_ELEM *Elem)
{
	INT i;
	unsigned short Seq, Alg, RspReason, Status;
	u8 Addr1[MAC_ADDR_LEN];
	u8 Addr2[MAC_ADDR_LEN];
	CHAR Chtxt[CIPHER_TEXT_LEN];
	uint32_t apidx;

	PHEADER_802_11 pRcvHdr;
	HEADER_802_11 AuthHdr;
	u8 *pOutBuffer = NULL;
	int NStatus;
	ULONG FrameLen = 0;
	MAC_TABLE_ENTRY *pEntry;
	u8 ChTxtIe = 16, ChTxtLen = CIPHER_TEXT_LEN;
	MULTISSID_STRUCT *pMbss;
	struct rtmp_wifi_dev *wdev;
	CHAR rssi;



	if (! APPeerAuthSanity(pAd, Elem->Msg, Elem->MsgLen, Addr1,
							Addr2, &Alg, &Seq, &Status, Chtxt
		))
		return;


	/* Find which MBSSID to be authenticate */
	apidx = get_apidx_by_addr(pAd, Addr1);
	if (apidx >= pAd->ApCfg.BssidNum)
	{
		DBGPRINT(RT_DEBUG_TRACE, ("AUTH - Bssid not found\n"));
		return;
	}

	pMbss = &pAd->ApCfg.MBSSID[apidx];
	wdev = &pMbss->wdev;

	if ((wdev->if_dev == NULL) || ((wdev->if_dev != NULL) &&
		!(RTMP_OS_NETDEV_STATE_RUNNING(wdev->if_dev))))
	{
		DBGPRINT(RT_DEBUG_TRACE, ("AUTH - Bssid IF didn't up yet.\n"));
	   	return;
	}


	pEntry = MacTableLookup(pAd, Addr2);
	if (pEntry && IS_ENTRY_CLIENT(pEntry))
	{

		if (!RTMPEqualMemory(Addr1, pAd->ApCfg.MBSSID[pEntry->apidx].wdev.bssid, MAC_ADDR_LEN))
		{
			MacTableDeleteEntry(pAd, pEntry->wcid, pEntry->Addr);
			pEntry = NULL;
			DBGPRINT(RT_DEBUG_WARN, ("AUTH - Bssid does not match\n"));
		}
		else
		{
			if (pEntry->bIAmBadAtheros == true)
			{
				AsicUpdateProtect(pAd, 8, ALLN_SETPROTECT, false, false);
				DBGPRINT(RT_DEBUG_TRACE, ("Atheros Problem. Turn on RTS/CTS!!!\n"));
				pEntry->bIAmBadAtheros = false;
			}

			BASessionTearDownALL(pAd, pEntry->wcid);
			ASSERT(pEntry->Aid == Elem->Wcid);
		}
	}


    pRcvHdr = (PHEADER_802_11)(Elem->Msg);
	DBGPRINT(RT_DEBUG_TRACE,
			("AUTH - MBSS(%d), Rcv AUTH seq#%d, Alg=%d, Status=%d from "
			"[wcid=%d]%02x:%02x:%02x:%02x:%02x:%02x\n",
			apidx, Seq, Alg, Status, Elem->Wcid, PRINT_MAC(Addr2)));

        /* [email protected]: Refuse the weak signal of AuthReq */
         rssi = RTMPMaxRssi(pAd,  ConvertToRssi(pAd, (CHAR)Elem->Rssi0, RSSI_0),
                                  ConvertToRssi(pAd, (CHAR)Elem->Rssi1, RSSI_1),
                                  ConvertToRssi(pAd, (CHAR)Elem->Rssi2, RSSI_2));
         DBGPRINT(RT_DEBUG_TRACE, ("%s: AUTH_FAIL_REQ Threshold = %d, AUTH_NO_RSP_REQ Threshold = %d, AUTH RSSI = %d\n",
 				  wdev->if_dev->name, pMbss->AuthFailRssiThreshold, pMbss->AuthNoRspRssiThreshold, rssi));

         if (((pMbss->AuthFailRssiThreshold != 0) && (rssi < pMbss->AuthFailRssiThreshold)) ||
            ((pMbss->AuthNoRspRssiThreshold != 0) && (rssi < pMbss->AuthNoRspRssiThreshold)))
         {
                DBGPRINT(RT_DEBUG_TRACE, ("Reject this AUTH_REQ due to Weak Signal.\n"));

		if ((pMbss->AuthFailRssiThreshold != 0) && (rssi < pMbss->AuthFailRssiThreshold))
                	APPeerAuthSimpleRspGenAndSend(pAd, pRcvHdr, Alg, Seq + 1, MLME_UNSPECIFY_FAIL);

                /* If this STA exists, delete it. */
                if (pEntry)
                        MacTableDeleteEntry(pAd, pEntry->Aid, pEntry->Addr);

                RTMPSendWirelessEvent(pAd, IW_MAC_FILTER_LIST_EVENT_FLAG, Addr2, apidx, 0);
//.........这里部分代码省略.........
开发者ID:ulli-kroll,项目名称:mt7612u,代码行数:101,代码来源:ap_auth.c

示例14: RtmpChipOpsEepromHook

INT RtmpChipOpsEepromHook(
	IN RTMP_ADAPTER *pAd,
	IN INT			infType)
{
	RTMP_CHIP_OP	*pChipOps = &pAd->chipOps;
#ifdef RT30xx
#ifdef RTMP_EFUSE_SUPPORT
	UINT32			eFuseCtrl, MacCsr0;
	int index;
#endif
#endif

#ifdef RTMP_FLASH_SUPPORT
	pChipOps->eeinit = rtmp_nv_init;
	pChipOps->eeread = rtmp_ee_flash_read;
	pChipOps->eewrite = rtmp_ee_flash_write;
	return 0;
#endif /* RTMP_FLASH_SUPPORT */

#ifdef RT30xx
#ifdef RTMP_EFUSE_SUPPORT
	index = 0;
	do
	{
		if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST))			
			return -1;
		
		RTMP_IO_READ32(pAd, MAC_CSR0, &MacCsr0);
		pAd->MACVersion = MacCsr0;

		if ((pAd->MACVersion != 0x00) && (pAd->MACVersion != 0xFFFFFFFF))
			break;

		RTMPusecDelay(10);
	} while (index++ < 100);
	
	pAd->bUseEfuse=FALSE;
#ifdef RT3290
	if (IS_RT3290(pAd))
	{
		RTMP_IO_READ32(pAd, EFUSE_CTRL_3290, &eFuseCtrl);
	}
	else
#endif /* RT3290 */
	{
		RTMP_IO_READ32(pAd, EFUSE_CTRL, &eFuseCtrl);
	}

	pAd->bUseEfuse = ( (eFuseCtrl & 0x80000000) == 0x80000000) ? 1 : 0;	
	if(pAd->bUseEfuse)
	{
		pChipOps->eeinit = eFuse_init;
		pChipOps->eeread = rtmp_ee_efuse_read16;
		pChipOps->eewrite = rtmp_ee_efuse_write16;
		DBGPRINT(RT_DEBUG_TRACE, ("NVM is EFUSE\n"));
		return 0 ;	
	}
	else
	{
		pAd->bFroceEEPROMBuffer = FALSE;
		DBGPRINT(RT_DEBUG_TRACE, ("NVM is EEPROM\n"));
	}
#endif /* RTMP_EFUSE_SUPPORT */
#endif /* RT30xx */

	switch(infType) 
	{


#ifdef RTMP_USB_SUPPORT
		case RTMP_DEV_INF_USB:
			pChipOps->eeinit = NULL;
			pChipOps->eeread = RTUSBReadEEPROM16;
			pChipOps->eewrite = RTUSBWriteEEPROM16;
			break;
#endif /* RTMP_USB_SUPPORT */
		default:
			DBGPRINT(RT_DEBUG_ERROR, ("RtmpChipOpsEepromHook() failed!\n"));
			break;
	}

	return 0;
}
开发者ID:1950packard,项目名称:rt3573sta,代码行数:83,代码来源:eeprom.c

示例15: SIPFW_ParseOpt

/*解析命令选项*/
static int SIPFW_ParseOpt(int opt, char *str, union sipfw_variant *var)
{
	const struct vec *p = NULL;
	int chain = SIPFW_CHAIN_ALL;
	int action = SIPFW_ACTION_DROP;
	unsigned int port = 0,ip = 0;
	int protocol = 0, i = 0;

	DBGPRINT("==>SIPFW_ParseOpt\n");
	switch(opt)
	{
		case SIPFW_OPT_CHAIN:/*链名称*/
			if(str){				
				for(i = 0;i<SIPFW_CHAIN_NUM;i++){/*遍历链查找匹配项*/
					if(!strncmp(str, sipfw_chain_name[i].ptr, sipfw_chain_name[i].len)){
						chain = i;
						break;
					}
				}
			}
			var->v_uint = chain;
			break;
		case SIPFW_OPT_ACTION:/*动作名称匹配*/
			if(str)	{				
				for(i = 0;i<SIPFW_ACTION_NUM;i++){/*查找动作名称并匹配*/				
					if(!strncmp(str, sipfw_action_name[i].ptr, sipfw_action_name[i].len))	{
						action = i;
						break;
					}
				}
			}
			var->v_uint = action;
			break;
		case SIPFW_OPT_IP:/*将字符串转为网络字节序*/
			if(str)
				ip = inet_addr(str);

			var->v_uint = ip;
			break;
			
		case SIPFW_OPT_PORT:/*将字符串类型转为网络序*/
			if(str){
				port = htons(strtoul(str, NULL, 10));
			}
			var->v_uint = port;
			break;
			
		case SIPFW_OPT_PROTOCOL:/*将协议的名称转为值*/
			if(str){
				for(p=sipfw_protocol_name + 0; p->ptr != NULL; p++){
					if(!strncmp(p->ptr, str, p->len)){
						protocol = p->value;
						break;
					}
				}
			}
			var->v_uint = protocol;
			break;
			
		case SIPFW_OPT_STR:/*字符串直接拷贝*/
			if(str){
				int 	len = strlen(str);
				memset(var->v_str, 0, sizeof(var->v_str));
				if(len < 8){
					memcpy(var->v_str, str, len);

				}
			}
			break;

		default:
			break;
	}
	DBGPRINT("<==SIPFW_ParseOpt\n");
}
开发者ID:Afaren,项目名称:reference,代码行数:76,代码来源:sipfw_u.c


注:本文中的DBGPRINT函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。