Annotation of embedaddon/strongswan/src/libstrongswan/pen/pen.h, revision 1.1
1.1 ! misho 1: /*
! 2: * Copyright (C) 2011-2015 Andreas Steffen
! 3: * HSR Hochschule fuer Technik Rapperswil
! 4: *
! 5: * This program is free software; you can redistribute it and/or modify it
! 6: * under the terms of the GNU General Public License as published by the
! 7: * Free Software Foundation; either version 2 of the License, or (at your
! 8: * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
! 9: *
! 10: * This program is distributed in the hope that it will be useful, but
! 11: * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
! 12: * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
! 13: * for more details.
! 14: */
! 15:
! 16: /**
! 17: * @defgroup pen pen
! 18: * @ingroup libstrongswan
! 19: *
! 20: * @defgroup pent pen
! 21: * @{ @ingroup pen
! 22: */
! 23:
! 24: #ifndef PEN_H_
! 25: #define PEN_H_
! 26:
! 27: #include <library.h>
! 28:
! 29: typedef enum pen_t pen_t;
! 30: typedef struct pen_type_t pen_type_t;
! 31:
! 32: /**
! 33: * Private enterprise numbers allocated by IANA.
! 34: *
! 35: * http://www.iana.org/assignments/enterprise-numbers
! 36: */
! 37: enum pen_t {
! 38: PEN_IETF = 0x000000, /* 0 */
! 39: PEN_IBM = 0x000002, /* 2 */
! 40: PEN_MICROSOFT = 0x000137, /* 311 */
! 41: PEN_REDHAT = 0x000908, /* 2312 */
! 42: PEN_PWG = 0x000A8B, /* 2699 */
! 43: PEN_ALTIGA = 0x000c04, /* 3076 */
! 44: PEN_OSC = 0x002358, /* 9048 */
! 45: PEN_DEBIAN = 0x002572, /* 9586 */
! 46: PEN_GOOGLE = 0x002B79, /* 11129 */
! 47: PEN_TCG = 0x005597, /* 21911 */
! 48: PEN_CANONICAL = 0x007132, /* 28978 */
! 49: PEN_FEDORA = 0x0076C1, /* 30401 */
! 50: PEN_FHH = 0x0080ab, /* 32939 */
! 51: PEN_ITA = 0x00902a, /* 36906 */
! 52: PEN_OPENPTS = 0x00950e, /* 38158 */
! 53: PEN_UNASSIGNED = 0xfffffe, /* 16777214 */
! 54: PEN_RESERVED = 0xffffff, /* 16777215 */
! 55: };
! 56:
! 57: /**
! 58: * Vendor specific type in vendor specific namespace.
! 59: */
! 60: struct pen_type_t {
! 61: pen_t vendor_id;
! 62: uint32_t type;
! 63: };
! 64:
! 65: /**
! 66: * Create a pen_type_t struct
! 67: *
! 68: * @param vendor_id vendor ID to create a pen_type_t
! 69: * @param type type to create a pen_type_t
! 70: * @return created pen_type_t
! 71: */
! 72: static inline pen_type_t pen_type_create(pen_t vendor_id, uint32_t type)
! 73: {
! 74: pen_type_t pen_type = { vendor_id, type };
! 75: return pen_type;
! 76: }
! 77:
! 78: /**
! 79: * Check two pen_type_t for equality.
! 80: *
! 81: * @param a first pen_type_t to compare
! 82: * @param b second pen_type_t to compare
! 83: * @return TRUE if a == b
! 84: */
! 85: static inline bool pen_type_equals(pen_type_t a, pen_type_t b)
! 86: {
! 87: return a.vendor_id == b.vendor_id && a.type == b.type;
! 88: }
! 89:
! 90: /**
! 91: * Check if a pen_type_t matches vendor and type.
! 92: *
! 93: * @param pen_type pen_type_t to compare
! 94: * @param vendor_id vendor to check in pen_type
! 95: * @param type type to check in pen_type
! 96: * @return TRUE if vendor_id and type matches pen_type
! 97: */
! 98: static inline bool pen_type_is(pen_type_t pen_type,
! 99: pen_t vendor_id, uint32_t type)
! 100: {
! 101: return pen_type.vendor_id == vendor_id && pen_type.type == type;
! 102: }
! 103:
! 104: /**
! 105: * enum names for pen_t.
! 106: */
! 107: extern enum_name_t *pen_names;
! 108:
! 109: #endif /** PEN_H_ @}*/
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>