Annotation of embedaddon/strongswan/src/libcharon/encoding/payloads/notify_payload.h, revision 1.1

1.1     ! misho       1: /*
        !             2:  * Copyright (C) 2006-2018 Tobias Brunner
        !             3:  * Copyright (C) 2006 Daniel Roethlisberger
        !             4:  * Copyright (C) 2005-2006 Martin Willi
        !             5:  * Copyright (C) 2005 Jan Hutter
        !             6:  * HSR Hochschule fuer Technik Rapperswil
        !             7:  *
        !             8:  * This program is free software; you can redistribute it and/or modify it
        !             9:  * under the terms of the GNU General Public License as published by the
        !            10:  * Free Software Foundation; either version 2 of the License, or (at your
        !            11:  * option) any later version.  See <http://www.fsf.org/copyleft/gpl.txt>.
        !            12:  *
        !            13:  * This program is distributed in the hope that it will be useful, but
        !            14:  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
        !            15:  * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
        !            16:  * for more details.
        !            17:  */
        !            18: 
        !            19: /**
        !            20:  * @defgroup notify_payload notify_payload
        !            21:  * @{ @ingroup payloads
        !            22:  */
        !            23: 
        !            24: #ifndef NOTIFY_PAYLOAD_H_
        !            25: #define NOTIFY_PAYLOAD_H_
        !            26: 
        !            27: typedef enum notify_type_t notify_type_t;
        !            28: typedef struct notify_payload_t notify_payload_t;
        !            29: 
        !            30: #include <library.h>
        !            31: #include <encoding/payloads/payload.h>
        !            32: #include <encoding/payloads/proposal_substructure.h>
        !            33: #include <collections/linked_list.h>
        !            34: 
        !            35: /**
        !            36:  * Notify message types for IKEv2, and a subset for IKEv1.
        !            37:  */
        !            38: enum notify_type_t {
        !            39:        /* notify error messages */
        !            40:        UNSUPPORTED_CRITICAL_PAYLOAD = 1,
        !            41:        /* IKEv1 alias */
        !            42:        INVALID_PAYLOAD_TYPE = 1,
        !            43:        INVALID_IKE_SPI = 4,
        !            44:        INVALID_MAJOR_VERSION = 5,
        !            45:        INVALID_SYNTAX = 7,
        !            46:        /* IKEv1 alias */
        !            47:        INVALID_EXCHANGE_TYPE = 7,
        !            48:        INVALID_MESSAGE_ID = 9,
        !            49:        INVALID_SPI = 11,
        !            50:        /* IKEv1 only */
        !            51:        ATTRIBUTES_NOT_SUPPORTED = 13,
        !            52:        /* IKEv1 alias */
        !            53:        NO_PROPOSAL_CHOSEN = 14,
        !            54:        /* IKEv1 only */
        !            55:        PAYLOAD_MALFORMED = 16,
        !            56:        INVALID_KE_PAYLOAD = 17,
        !            57:        /* IKEv1 alias */
        !            58:        INVALID_KEY_INFORMATION = 17,
        !            59:        /* IKEv1 only */
        !            60:        INVALID_ID_INFORMATION = 18,
        !            61:        INVALID_CERT_ENCODING = 19,
        !            62:        INVALID_CERTIFICATE = 20,
        !            63:        CERT_TYPE_UNSUPPORTED = 21,
        !            64:        INVALID_CERT_AUTHORITY = 22,
        !            65:        INVALID_HASH_INFORMATION = 23,
        !            66:        AUTHENTICATION_FAILED = 24,
        !            67:        SINGLE_PAIR_REQUIRED = 34,
        !            68:        NO_ADDITIONAL_SAS = 35,
        !            69:        INTERNAL_ADDRESS_FAILURE = 36,
        !            70:        FAILED_CP_REQUIRED = 37,
        !            71:        TS_UNACCEPTABLE = 38,
        !            72:        INVALID_SELECTORS = 39,
        !            73:        /* mobile extension, RFC 4555 */
        !            74:        UNACCEPTABLE_ADDRESSES = 40,
        !            75:        UNEXPECTED_NAT_DETECTED = 41,
        !            76:        /* mobile IPv6 bootstrapping, RFC 5026 */
        !            77:        USE_ASSIGNED_HoA = 42,
        !            78:        /* IKEv2 RFC 5996 */
        !            79:        TEMPORARY_FAILURE = 43,
        !            80:        CHILD_SA_NOT_FOUND = 44,
        !            81: 
        !            82:        /* IKE-ME, private use */
        !            83:        ME_CONNECT_FAILED = 8192,
        !            84: 
        !            85:        /* Windows error code */
        !            86:        MS_NOTIFY_STATUS = 12345,
        !            87: 
        !            88:        /* notify status messages */
        !            89:        INITIAL_CONTACT = 16384,
        !            90:        SET_WINDOW_SIZE = 16385,
        !            91:        ADDITIONAL_TS_POSSIBLE = 16386,
        !            92:        IPCOMP_SUPPORTED = 16387,
        !            93:        NAT_DETECTION_SOURCE_IP = 16388,
        !            94:        NAT_DETECTION_DESTINATION_IP = 16389,
        !            95:        COOKIE = 16390,
        !            96:        USE_TRANSPORT_MODE = 16391,
        !            97:        HTTP_CERT_LOOKUP_SUPPORTED = 16392,
        !            98:        REKEY_SA = 16393,
        !            99:        ESP_TFC_PADDING_NOT_SUPPORTED = 16394,
        !           100:        NON_FIRST_FRAGMENTS_ALSO = 16395,
        !           101:        /* mobike extension, RFC4555 */
        !           102:        MOBIKE_SUPPORTED = 16396,
        !           103:        ADDITIONAL_IP4_ADDRESS = 16397,
        !           104:        ADDITIONAL_IP6_ADDRESS = 16398,
        !           105:        NO_ADDITIONAL_ADDRESSES = 16399,
        !           106:        UPDATE_SA_ADDRESSES = 16400,
        !           107:        COOKIE2 = 16401,
        !           108:        NO_NATS_ALLOWED = 16402,
        !           109:        /* repeated authentication extension, RFC4478 */
        !           110:        AUTH_LIFETIME = 16403,
        !           111:        /* multiple authentication exchanges, RFC 4739 */
        !           112:        MULTIPLE_AUTH_SUPPORTED = 16404,
        !           113:        ANOTHER_AUTH_FOLLOWS = 16405,
        !           114:        /* redirect mechanism, RFC 5685 */
        !           115:        REDIRECT_SUPPORTED = 16406,
        !           116:        REDIRECT = 16407,
        !           117:        REDIRECTED_FROM = 16408,
        !           118:        /* session resumption, RFC 5723 */
        !           119:        TICKET_LT_OPAQUE = 16409,
        !           120:        TICKET_REQUEST = 16410,
        !           121:        TICKET_ACK = 16411,
        !           122:        TICKET_NACK = 16412,
        !           123:        TICKET_OPAQUE = 16413,
        !           124:        /* IPv6 configuration, RFC 5739 */
        !           125:        LINK_ID = 16414,
        !           126:        /* wrapped esp, RFC 5840 */
        !           127:        USE_WESP_MODE = 16415,
        !           128:        /* robust header compression, RFC 5857 */
        !           129:        ROHC_SUPPORTED = 16416,
        !           130:        /* EAP-only authentication, RFC 5998 */
        !           131:        EAP_ONLY_AUTHENTICATION = 16417,
        !           132:        /* Childless initiation of IKEv2 SA, RFC 6023 */
        !           133:        CHILDLESS_IKEV2_SUPPORTED = 16418,
        !           134:        /* Quick crash detection for IKE, RFC 6290 */
        !           135:        QUICK_CRASH_DETECTION = 16419,
        !           136:        /* High availability of IKEv2/IPsec, RFC 6311 */
        !           137:        IKEV2_MESSAGE_ID_SYNC_SUPPORTED = 16420,
        !           138:        IKEV2_REPLAY_COUNTER_SYNC_SUPPORTED = 16421,
        !           139:        IKEV2_MESSAGE_ID_SYNC = 16422,
        !           140:        IPSEC_REPLAY_COUNTER_SYNC = 16423,
        !           141:        /* Secure password methods, RFC 6467 */
        !           142:        SECURE_PASSWORD_METHOD = 16424,
        !           143:        /* PACE, RFC 6631 */
        !           144:        PSK_PERSIST = 16425,
        !           145:        PSK_CONFIRM = 16426,
        !           146:        /* EAP Re-authentication Extension, RFC 6867 */
        !           147:        ERX_SUPPORTED = 16427,
        !           148:        /* IFOM capability, 3GPP TS 24.303, annex B.2 */
        !           149:        IFOM_CAPABILITY = 16428,
        !           150:        /* SENDER_REQUEST_ID (draft-yeung-g-ikev2) */
        !           151:        SENDER_REQUEST_ID = 16429,
        !           152:        /* IKEv2 fragmentation supported, RFC 7383 */
        !           153:        FRAGMENTATION_SUPPORTED = 16430,
        !           154:        /* Signature Hash Algorithms, RFC 7427 */
        !           155:        SIGNATURE_HASH_ALGORITHMS = 16431,
        !           156:        /* Use Postquantum Preshared Key (draft-ietf-ipsecme-qr-ikev2) */
        !           157:        USE_PPK = 16435,
        !           158:        /* Postquantum Preshared Key Identity (draft-ietf-ipsecme-qr-ikev2) */
        !           159:        PPK_IDENTITY = 16436,
        !           160:        /* No Postquantum Preshared Key Auth (draft-ietf-ipsecme-qr-ikev2) */
        !           161:        NO_PPK_AUTH = 16437,
        !           162:        /* IKEv1 initial contact */
        !           163:        INITIAL_CONTACT_IKEV1 = 24578,
        !           164:        /* IKEv1 DPD */
        !           165:        DPD_R_U_THERE = 36136,
        !           166:        DPD_R_U_THERE_ACK = 36137,
        !           167:        /* IKEv1 Cisco High Availability */
        !           168:        UNITY_LOAD_BALANCE = 40501,
        !           169:        /* BEET mode, not even a draft yet. private use */
        !           170:        USE_BEET_MODE = 40961,
        !           171:        /* IKE-ME, private use */
        !           172:        ME_MEDIATION = 40962,
        !           173:        ME_ENDPOINT = 40963,
        !           174:        ME_CALLBACK = 40964,
        !           175:        ME_CONNECTID = 40965,
        !           176:        ME_CONNECTKEY = 40966,
        !           177:        ME_CONNECTAUTH = 40967,
        !           178:        ME_RESPONSE = 40968,
        !           179:        /* RADIUS attribute received/to send to a AAA backend */
        !           180:        RADIUS_ATTRIBUTE = 40969,
        !           181: };
        !           182: 
        !           183: /**
        !           184:  * enum name for notify_type_t.
        !           185:  */
        !           186: extern enum_name_t *notify_type_names;
        !           187: 
        !           188: /**
        !           189:  * enum name for notify_type_t (shorter strings).
        !           190:  */
        !           191: extern enum_name_t *notify_type_short_names;
        !           192: 
        !           193: /**
        !           194:  * Class representing an IKEv2-Notify Payload.
        !           195:  *
        !           196:  * The Notify Payload format is described in Draft section 3.10.
        !           197:  */
        !           198: struct notify_payload_t {
        !           199:        /**
        !           200:         * The payload_t interface.
        !           201:         */
        !           202:        payload_t payload_interface;
        !           203: 
        !           204:        /**
        !           205:         * Gets the protocol id of this payload.
        !           206:         *
        !           207:         * @return                      protocol id of this payload
        !           208:         */
        !           209:        uint8_t (*get_protocol_id) (notify_payload_t *this);
        !           210: 
        !           211:        /**
        !           212:         * Sets the protocol id of this payload.
        !           213:         *
        !           214:         * @param protocol_id   protocol id to set
        !           215:         */
        !           216:        void (*set_protocol_id) (notify_payload_t *this, uint8_t protocol_id);
        !           217: 
        !           218:        /**
        !           219:         * Gets the notify message type of this payload.
        !           220:         *
        !           221:         * @return                      notify message type of this payload
        !           222:         */
        !           223:        notify_type_t (*get_notify_type) (notify_payload_t *this);
        !           224: 
        !           225:        /**
        !           226:         * Sets notify message type of this payload.
        !           227:         *
        !           228:         * @param type          notify message type to set
        !           229:         */
        !           230:        void (*set_notify_type) (notify_payload_t *this, notify_type_t type);
        !           231: 
        !           232:        /**
        !           233:         * Returns the currently set spi of this payload.
        !           234:         *
        !           235:         * This is only valid for notifys with protocol AH|ESP
        !           236:         *
        !           237:         * @return              SPI value
        !           238:         */
        !           239:        uint32_t (*get_spi) (notify_payload_t *this);
        !           240: 
        !           241:        /**
        !           242:         * Sets the spi of this payload.
        !           243:         *
        !           244:         * This is only valid for notifys with protocol AH|ESP
        !           245:         *
        !           246:         * @param spi   SPI value
        !           247:         */
        !           248:        void (*set_spi) (notify_payload_t *this, uint32_t spi);
        !           249: 
        !           250:        /**
        !           251:         * Returns the currently set spi of this payload.
        !           252:         *
        !           253:         * This is only valid for notifys with protocol ISAKMP
        !           254:         *
        !           255:         * @return              SPI value
        !           256:         */
        !           257:        chunk_t (*get_spi_data) (notify_payload_t *this);
        !           258: 
        !           259:        /**
        !           260:         * Sets the spi of this payload.
        !           261:         *
        !           262:         * This is only valid for notifys with protocol ISAKMP
        !           263:         *
        !           264:         * @param spi   SPI value
        !           265:         */
        !           266:        void (*set_spi_data) (notify_payload_t *this, chunk_t spi);
        !           267: 
        !           268:        /**
        !           269:         * Returns the currently set notification data of payload.
        !           270:         *
        !           271:         * Returned data are not copied.
        !           272:         *
        !           273:         * @return              chunk_t pointing to the value
        !           274:         */
        !           275:        chunk_t (*get_notification_data) (notify_payload_t *this);
        !           276: 
        !           277:        /**
        !           278:         * Sets the notification data of this payload.
        !           279:         *
        !           280:         * @warning Value is getting copied.
        !           281:         *
        !           282:         * @param notification_data     chunk_t pointing to the value to set
        !           283:         */
        !           284:        void (*set_notification_data) (notify_payload_t *this,
        !           285:                                                                   chunk_t notification_data);
        !           286: 
        !           287:        /**
        !           288:         * Destroys an notify_payload_t object.
        !           289:         */
        !           290:        void (*destroy) (notify_payload_t *this);
        !           291: };
        !           292: 
        !           293: /**
        !           294:  * Creates an empty notify_payload_t object
        !           295:  *
        !           296:  * @param type         payload type, PLV2_NOTIFY or PLV1_NOTIFY
        !           297:  * @return                     created notify_payload_t object
        !           298:  */
        !           299: notify_payload_t *notify_payload_create(payload_type_t type);
        !           300: 
        !           301: /**
        !           302:  * Creates an notify_payload_t object of specific type for specific protocol id.
        !           303:  *
        !           304:  * @param type                                 payload type, PLV2_NOTIFY or PLV1_NOTIFY
        !           305:  * @param protocol                             protocol id (IKE, AH or ESP)
        !           306:  * @param notify                               type of notify
        !           307:  * @return                                             notify_payload_t object
        !           308:  */
        !           309: notify_payload_t *notify_payload_create_from_protocol_and_type(
        !           310:                        payload_type_t type, protocol_id_t protocol, notify_type_t notify);
        !           311: 
        !           312: #endif /** NOTIFY_PAYLOAD_H_ @}*/

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>