#ifndef _TLV_H_
#define _TLV_H_
#define TLV_FEC 0x0100
#define TLV_ADDRESS_LIST 0x0101
#define TLV_HOP_COUNT 0x0103
#define TLV_PATH_VECTOR 0x0104
#define TLV_GENERIC_LABEL 0x0200
#define TLV_ATM_LABEL 0x0201
#define TLV_FR_LABEL 0x0202
#define TLV_STATUS 0x0300
#define TLV_EXTENDED_STATUS 0x0301
#define TLV_RETURNED_PDU 0x0302
#define TLV_RETURNED_MESSAGE 0x0303
#define TLV_COMMON_HELLO 0x0400
#define TLV_IPV4_TRANSPORT 0x0401
#define TLV_CONFIGURATION_SEQ 0x0402
#define TLV_IPV6_TRANSPORT 0x0403
#define TLV_COMMON_SESSION 0x0500
#define TLV_ATM_SESSION 0x0501
#define TLV_FR_SESSION 0x0502
#define TLV_LABEL_REQUEST 0x0600
#define TLV_TYPE_LENGTH (sizeof(uint16_t) + sizeof(uint16_t))
#define MSGID_SIZE (sizeof(uint32_t))
struct tlv {
uint16_t type;
uint16_t length;
uint32_t messageid;
} __packed;
struct common_hello_tlv {
uint16_t type;
uint16_t length;
uint16_t holdtime;
uint16_t res;
} __packed;
struct hello_tlv {
uint16_t type;
uint16_t length;
uint32_t messageid;
struct common_hello_tlv ch;
} __packed;
struct transport_address_tlv {
uint16_t type;
uint16_t length;
union {
struct in_addr ip4addr;
struct in6_addr ip6addr;
} address;
} __packed;
#define CS_LEN (sizeof(struct init_tlv) - TLV_TYPE_LENGTH - MSGID_SIZE - \
sizeof(uint32_t))
struct init_tlv {
uint16_t type;
uint16_t length;
uint32_t messageid;
uint16_t cs_type;
uint16_t cs_len;
uint16_t cs_version;
uint16_t cs_keepalive;
uint16_t cs_adpvlim;
uint16_t cs_maxpdulen;
struct in_addr cs_peeraddress;
uint16_t cs_peeraddrspace;
} __packed;
struct ka_tlv {
uint16_t type;
uint16_t length;
uint32_t messageid;
} __packed;
struct notification_tlv {
uint16_t type;
uint16_t length;
uint32_t messageid;
uint16_t status;
uint16_t st_len;
uint32_t st_code;
uint32_t msg_id;
uint32_t msg_type;
} __packed;
struct address_list_tlv {
uint16_t type;
uint16_t length;
uint32_t messageid;
uint16_t a_type;
uint16_t a_length;
uint16_t a_af;
struct in_addr a_address;
} __packed;
struct al_tlv {
uint16_t type;
uint16_t length;
uint16_t af;
struct in_addr address;
} __packed;
struct address_tlv {
uint16_t type;
uint16_t length;
uint32_t messageid;
} __packed;
struct label_map_tlv {
uint16_t type;
uint16_t length;
uint32_t messageid;
} __packed;
struct fec_tlv {
uint16_t type;
uint16_t length;
} __packed;
struct prefix_tlv {
uint8_t type;
uint16_t af;
uint8_t prelen;
struct in_addr prefix;
} __packed;
struct host_tlv {
uint8_t type;
uint16_t af;
uint8_t length;
struct in_addr address;
} __packed;
struct label_tlv {
uint16_t type;
uint16_t length;
uint32_t label;
} __packed;
struct label_request_tlv {
uint16_t type;
uint16_t length;
uint32_t messageid;
} __packed;
struct hello_tlv * get_hello_tlv(unsigned char *, uint);
void debug_tlv(struct tlv *);
#endif