dpdk 0.0.1

A wrapper around DPDK
// This file is part of dpdk. It is subject to the license terms in the COPYRIGHT file found in the top-level directory of this distribution and at https://raw.githubusercontent.com/lemonrock/dpdk/master/COPYRIGHT. No part of dpdk, including this file, may be copied, modified, propagated, or distributed except according to the terms contained in the COPYRIGHT file.
// Copyright © 2016-2017 The developers of dpdk. See the COPYRIGHT file in the top-level directory of this distribution and at https://raw.githubusercontent.com/lemonrock/dpdk/master/COPYRIGHT.


#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct NullCryptoVirtualDevice
{
	index: u5,
	maximNumberOfQueuePairs: u31,
	maximNumberOfSessions: u31,
	numaSocketId: NumaSocketId,
}

impl VirtualDevice for NullCryptoVirtualDevice
{
	type V = CryptoVirtualDeviceDriverName;
	
	const DriverName: CryptoVirtualDeviceDriverName = CryptoVirtualDeviceDriverName::Null;
	
	#[inline(always)]
	fn index(&self) -> u5
	{
		self.index
	}
	
	#[inline(always)]
	fn formattedVirtualDeviceArgumentsWithLeadingComma(&self) -> String
	{
		self.formattedVirtualDeviceArgumentsWithLeadingCommaCommon()
	}
}

impl CryptoVirtualDevice for NullCryptoVirtualDevice
{
	#[inline(always)]
	fn maximNumberOfQueuePairs(&self) -> u31
	{
		self.maximNumberOfQueuePairs
	}
	
	#[inline(always)]
	fn maximNumberOfSessions(&self) -> u31
	{
		self.maximNumberOfSessions
	}
	
	#[inline(always)]
	fn numaSocketId(&self) -> NumaSocketId
	{
		self.numaSocketId
	}
}

impl NullCryptoVirtualDevice
{
	#[inline(always)]
	pub fn defaultish(index: u5, numaSocketId: NumaSocketId) -> Self
	{
		Self::new(index, numaSocketId, Self::DefaultMaximumNumberOfQueuePairs, Self::DefaultMaximumNumberOfSessions)
	}
	
	#[inline(always)]
	pub fn new(index: u5, numaSocketId: NumaSocketId, maximNumberOfQueuePairs: u31, maximNumberOfSessions: u31) -> Self
	{
		assert!(index < VirtualDeviceName::<CryptoVirtualDeviceDriverName>::MaximumIndex, "index '{}' can not equal or exceed MaximumIndex '{}'", index, VirtualDeviceName::<CryptoVirtualDeviceDriverName>::MaximumIndex);
		
		NullCryptoVirtualDevice
		{
			index: index,
			maximNumberOfQueuePairs: maximNumberOfQueuePairs,
			maximNumberOfSessions: maximNumberOfSessions,
			numaSocketId: numaSocketId,
		}
	}
}