Knight KE / Mbed OS Game_Master
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers pana_avp.h Source File

pana_avp.h

00001 /*
00002  * Copyright (c) 2017, Arm Limited and affiliates.
00003  * SPDX-License-Identifier: Apache-2.0
00004  *
00005  * Licensed under the Apache License, Version 2.0 (the "License");
00006  * you may not use this file except in compliance with the License.
00007  * You may obtain a copy of the License at
00008  *
00009  *     http://www.apache.org/licenses/LICENSE-2.0
00010  *
00011  * Unless required by applicable law or agreed to in writing, software
00012  * distributed under the License is distributed on an "AS IS" BASIS,
00013  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  * See the License for the specific language governing permissions and
00015  * limitations under the License.
00016  */
00017 
00018 #ifndef PANA_AVP_H_
00019 #define PANA_AVP_H_
00020 
00021 #define PANA_EAP_VENDOR_FLAG 0x8000
00022 
00023 #define AVP_AUTHENCY_CODE               1
00024 #define AVP_EAP_PAYLOAD_CODE            2
00025 #define AVP_INTEGRIRTY_ALGORYTHM_CODE   3
00026 #define AVP_KEY_ID_CODE                 4
00027 #define AVP_NONCE_CODE                  5
00028 #define AVP_PRF_ALGORYTHM_CODE          6
00029 #define AVP_RESULT_CODE                 7
00030 #define AVP_SESSION_LIFETIME_CODE       8
00031 /**
00032  * Pana relay AVP's
00033  */
00034 #define AVP_PAC_INFO_CODE               10
00035 #define AVP_RELAY_MSG_CODE              11
00036 
00037 /**
00038  * Define Key delivery method
00039  */
00040 #define AVP_KEY_WRAP_ALG_CODE           12
00041 /**
00042  * Key delivery AVP's which are encrypted at message
00043  */
00044 #define AVP_ENCRYPT_ALGORITHM_CODE      13
00045 
00046 
00047 /****************************************
00048  * Pana AVP Base
00049  *
00050  * Code     Flags   Length  RESErved
00051  * 16-bit   16-bit  16-bit  16-bit
00052  *
00053  */
00054 
00055 typedef struct {
00056     uint32_t vendor_id;
00057     uint16_t code;
00058     uint16_t flags;
00059     uint16_t len;
00060     uint8_t *avp_ptr;
00061 } pana_avp_t;
00062 
00063 uint8_t *pana_avp_base_write(uint8_t avp_type, uint16_t length, uint8_t *dptr, uint16_t flags, uint32_t vendor_id);
00064 
00065 uint8_t *pana_avp_32_bit_write(uint8_t avp_type,uint32_t value, uint8_t *dptr);
00066 /**
00067  * Write AVP header and data also if value is not NULL
00068  *
00069  * Add automatically padding's for word size 4
00070  *
00071  * \return pointer end of message
00072  */
00073 uint8_t *pana_avp_write_n_bytes(uint16_t avp_type, uint16_t length, const uint8_t *value, uint8_t *dptr);
00074 
00075 /**
00076  * Write AVP header with vendor id and data also if value is not NULL
00077  *
00078  * Add automatically padding's for word size 4
00079  *
00080  * \return pointer end of message
00081  */
00082 uint8_t *pana_avp_vendor_id_write_n_bytes(uint16_t avp_type, uint16_t length, const uint8_t *value, uint8_t *dptr, uint32_t vendor_id);
00083 
00084 bool pana_avp_discover(uint8_t *dptr, uint16_t data_len, pana_avp_t *avp);
00085 
00086 #endif /* PANA_AVP_H_ */