BA / Mbed OS BaBoRo1
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers pana_header.h Source File

pana_header.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_HEADER_H_
00019 #define PANA_HEADER_H_
00020 
00021 /****************************************
00022  * Pana Header Base
00023  * Reserved     Length  FlaGS   Type    Session ID  Sequncy Numb
00024  * 0x00 0x00    16-bit  16-bit  16-bit  32-bit      32-bit
00025  *
00026  */
00027 
00028 #define PANA_HEADER_LENGTH 16
00029 
00030 /**
00031  * Pana Message types
00032  */
00033 #define PANA_MSG_PCI 0x0001
00034 #define PANA_MSG_PA 0x0002
00035 #define PANA_MSG_PNA 0x0004
00036 #define PANA_MSG_RELAY 0x0005
00037 
00038 /**
00039  * Pana Message flags
00040  */
00041 #define PANA_FLAGS_REQUEST          0x8000
00042 #define PANA_FLAGS_RESPONSE         0x0000
00043 #define PANA_FLAGS_START            0x4000
00044 #define PANA_FLAGS_COMPLETE         0x2000
00045 #define PANA_FLAG_START_REQ_MASK    (PANA_FLAGS_REQUEST | PANA_FLAGS_START)
00046 #define PANA_FLAGS_PING_RESPONSE    0x0000
00047 #define PANA_FLAGS_PING             0x0800
00048 
00049 typedef struct {
00050     uint16_t flags;
00051     uint16_t type;
00052     uint16_t payload_len;
00053     uint32_t session_id;
00054     uint32_t seq;
00055     bool agent_retry;
00056 } pana_header_t;
00057 
00058 bool pana_header_parse(uint8_t *ptr, uint16_t data_length, pana_header_t *header);
00059 uint8_t *pana_header_write(uint8_t *ptr, const pana_header_t *header);
00060 
00061 #endif /* PANA_HEADER_H_ */