mpls_lm_dm_pack.h (4299B)
1 /* 2 * 3 * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file. 4 * 5 * Copyright 2007-2019 Broadcom Inc. All rights reserved. 6 * 7 * File: mpls_lm_dm_pack.h 8 * Purpose: Interface to pack and unpack routines common to 9 * SDK and uKernel for: 10 * - MPLS_LM_DM Control messages 11 * - Network Packet headers 12 * 13 * This is to be shared between SDK host and uKernel. 14 */ 15 16 #ifndef _SOC_SHARED_MPLS_LM_DM_PACK_H_ 17 #define _SOC_SHARED_MPLS_LM_DM_PACK_H_ 18 19 #ifdef BCM_UKERNEL 20 /* Build for uKernel not SDK */ 21 #include "sdk_typedefs.h" 22 #else 23 #include <sal/types.h> 24 #endif 25 26 #include <soc/shared/mpls_lm_dm_msg.h> 27 #include <soc/shared/mpls_lm_dm_pkt.h> 28 29 /* 30 * TLV Types 31 */ 32 #define SHR_MPLS_LM_DM_TLV_END 0x00 33 #define SHR_MPLS_LM_DM_TLV_TARGET_MEP 0x21 34 #define SHR_MPLS_LM_DM_TLV_REPLYING_MEP 0x22 35 #define SHR_MPLS_LM_DM_TLV_REQUESTING_MEP 0x23 36 37 /* 38 * TLV Subtypes 39 */ 40 #define SHR_MPLS_LM_DM_TLV_MEP_SUB_INGRESS_DISCOVERY 0x00 41 #define SHR_MPLS_LM_DM_TLV_MEP_SUB_EGRESS_DISCOVERY 0x01 42 #define SHR_MPLS_LM_DM_TLV_MEP_SUB_MEP_ICC_ID 0x02 43 #define SHR_MPLS_LM_DM_TLV_MEP_SUB_MIP_ICC_ID 0x03 44 45 #define SHR_MPLS_LM_DM_ID_ZERO_LEN 24 46 47 48 typedef struct { 49 uint8 zero[24]; 50 } mpls_lm_dm_discovery_id_t; 51 52 typedef struct { 53 uint16 mep_id; 54 uint8 zero[22]; 55 } mpls_lm_dm_reply_icc_t; 56 57 typedef struct { 58 uint8 carrier_code[6]; 59 uint32 node_id; 60 uint32 if_num; 61 uint8 zero[10]; 62 } mpls_lm_dm_reply_mip_icc_t; 63 64 typedef struct { 65 uint16 mep_id; 66 uint8 meg_id[48]; 67 uint16 reserved; 68 } mpls_lm_dm_requesting_mep_t; 69 70 #define SHR_MPLS_LM_DM_TLV_MAX_VALUE_LEN sizeof(mpls_lm_dm_requesting_mep_t) 71 72 typedef struct { 73 uint8 type; 74 uint16 length; 75 uint8 subtype; 76 union { 77 uint8 data[SHR_MPLS_LM_DM_TLV_MAX_VALUE_LEN]; 78 mpls_lm_dm_discovery_id_t discovery; 79 mpls_lm_dm_reply_icc_t reply_icc; 80 mpls_lm_dm_reply_mip_icc_t reply_mip_icc; 81 mpls_lm_dm_requesting_mep_t requesting; 82 } value; 83 } shr_mpls_lm_dm_tlv_t; 84 85 /* MPLS_LM_DM Control Messages pack/unpack */ 86 extern uint8 * 87 shr_mpls_lm_dm_msg_ctrl_init_pack(uint8 *buf, shr_mpls_lm_dm_msg_ctrl_init_t *msg); 88 extern uint8 * 89 shr_mpls_lm_dm_msg_ctrl_init_unpack(uint8 *buf, shr_mpls_lm_dm_msg_ctrl_init_t *msg); 90 extern uint8 * 91 shr_mpls_lm_dm_msg_ctrl_loss_add_pack(uint8 *buf, 92 shr_mpls_lm_dm_msg_ctrl_loss_add_t *msg); 93 extern uint8 * 94 shr_mpls_lm_dm_msg_ctrl_loss_add_unpack(uint8 *buf, 95 shr_mpls_lm_dm_msg_ctrl_loss_add_t *msg); 96 extern uint8 * 97 shr_mpls_lm_dm_msg_ctrl_loss_delete_pack(uint8 *buf, 98 shr_mpls_lm_dm_msg_ctrl_loss_delete_t *msg); 99 extern uint8 * 100 shr_mpls_lm_dm_msg_ctrl_loss_delete_unpack(uint8 *buf, 101 shr_mpls_lm_dm_msg_ctrl_loss_delete_t *msg); 102 extern uint8 * 103 shr_mpls_lm_dm_msg_ctrl_loss_get_pack(uint8 *buf, 104 shr_mpls_lm_dm_msg_ctrl_loss_get_t *msg); 105 extern uint8 * 106 shr_mpls_lm_dm_msg_ctrl_loss_get_unpack(uint8 *buf, 107 shr_mpls_lm_dm_msg_ctrl_loss_get_t *msg); 108 extern uint8 * 109 shr_mpls_lm_dm_msg_ctrl_loss_data_pack(uint8 *buf, 110 shr_mpls_lm_dm_msg_ctrl_loss_data_t *msg); 111 extern uint8 * 112 shr_mpls_lm_dm_msg_ctrl_loss_data_unpack(uint8 *buf, 113 shr_mpls_lm_dm_msg_ctrl_loss_data_t *msg); 114 115 extern uint8 * 116 shr_mpls_lm_dm_msg_ctrl_delay_add_pack(uint8 *buf, 117 shr_mpls_lm_dm_msg_ctrl_delay_add_t *msg); 118 extern uint8 * 119 shr_mpls_lm_dm_msg_ctrl_delay_add_unpack(uint8 *buf, 120 shr_mpls_lm_dm_msg_ctrl_delay_add_t *msg); 121 extern uint8 * 122 shr_mpls_lm_dm_msg_ctrl_delay_delete_pack(uint8 *buf, 123 shr_mpls_lm_dm_msg_ctrl_delay_delete_t *msg); 124 extern uint8 * 125 shr_mpls_lm_dm_msg_ctrl_delay_delete_unpack(uint8 *buf, 126 shr_mpls_lm_dm_msg_ctrl_delay_delete_t *msg); 127 extern uint8 * 128 shr_mpls_lm_dm_msg_ctrl_delay_get_pack(uint8 *buf, 129 shr_mpls_lm_dm_msg_ctrl_delay_get_t *msg); 130 extern uint8 * 131 shr_mpls_lm_dm_msg_ctrl_delay_get_unpack(uint8 *buf, 132 shr_mpls_lm_dm_msg_ctrl_delay_get_t *msg); 133 extern uint8 * 134 shr_mpls_lm_dm_msg_ctrl_delay_data_pack(uint8 *buf, 135 shr_mpls_lm_dm_msg_ctrl_delay_data_t *msg); 136 extern uint8 * 137 shr_mpls_lm_dm_msg_ctrl_delay_data_unpack(uint8 *buf, 138 shr_mpls_lm_dm_msg_ctrl_delay_data_t *msg); 139 140 141 #endif /* _SOC_SHARED_MPLS_LM_DM_PACK_H_ */