#[derive(Debug, Clone, Ord, PartialOrd, Eq, PartialEq, Hash)]
#[derive(Deserialize, Serialize)]
#[serde(deny_unknown_fields)]
pub enum BpfProgramLicense
{
GPL,
GPLv2,
GPLAndAdditionalRights,
DualBSDAndGPL,
DualMITAndGPL,
DualMPLAndGPL,
Other(CString),
}
impl Default for BpfProgramLicense
{
#[inline(always)]
fn default() -> Self
{
Self::GPLv2
}
}
impl BpfProgramLicense
{
#[inline(always)]
pub(crate) fn as_aligned_u64(&self) -> AlignedU64
{
use self::BpfProgramLicense::*;
let pointer = match self
{
GPL => b"GPL\0".as_ptr(),
GPLv2 => b"GPL v2\0".as_ptr(),
GPLAndAdditionalRights => b"GPL and additional rights\0".as_ptr(),
DualBSDAndGPL => b"Dual BSD/GPL\0".as_ptr(),
DualMITAndGPL => b"Dual MIT/GPL\0".as_ptr(),
DualMPLAndGPL => b"Dual MPL/GPL\0".as_ptr(),
Other(other) => other.as_ptr() as *const u8
};
AlignedU64::from(pointer)
}
}