/****************************************************************
 ****************************************************************
 **                                                            **
 **    (C)Copyright 2005-2006, American Megatrends Inc.        **
 **                                                            **
 **            All Rights Reserved.                            **
 **                                                            **
 **        6145-F, Northbelt Parkway, Norcross,                **
 **                                                            **
 **        Georgia - 30071, USA. Phone-(770)-246-8600.         **
 **                                                            **
 ****************************************************************
 ****************************************************************
 ****************************************************************
 *
 * ipmi_LANIfc.h
 * LAN Interface structures
 *
 * Author: Govind Kothandapani <govindk@ami.com>
 *       : Bakka Ravinder Reddy <bakkar@ami.com>
 *
 *****************************************************************/
#ifndef IPMI_LANIFC_H
#define IPMI_LANIFC_H
#include <stdio.h>
#include <stdint.h>
#include "com_IPMI_RMCP.h"
#include "com_IPMIDefs.h"

#pragma pack( 1 )

/**
 * @struct MACHdr_T
 * @brief MAC header of LAN interface packet.
**/
typedef struct
{
    uint8_t   DestAddr [MAC_ADDR_LEN];
    uint8_t   SrcAddr [MAC_ADDR_LEN];

}    MACHdr_T;

typedef union
{
    /*IPv6 Header */
    struct
    {
        uint32_t Hdr1;/* Version Class and Flow Lable*/
        uint16_t Payload_Len;
        uint8_t Nxt_Hdr;
        uint8_t HOPLIMIT;
        uint8_t   Srcv6Addr [IP6_ADDR_LEN];
        uint8_t   Destv6Addr [IP6_ADDR_LEN];
    };
    /*IPv4 Header */
    struct
    {
        uint8_t   Ver_HdrLen;
        uint8_t   Prec_SerType;
        uint16_t  TotalLen;
        uint16_t  Id;
        uint16_t  Flags_FragOffset;
        uint8_t   TTL;
        uint8_t   Protocol;
        uint16_t  IPHdrChecksum;
        uint8_t   Srcv4Addr [IP_ADDR_LEN];
        uint8_t   Destv4Addr [IP_ADDR_LEN];
    };
}   IPHdr_T;

/**
 * @struct UDPHdr_T
 * @brief UDP header of LAN interface packet.
**/
typedef struct
{
    uint16_t  SrcPort;
    uint16_t  DestPort;
    uint16_t  UDPLen;
    uint16_t  UDPChecksum;

}    UDPHdr_T;


/**
 * @struct LANRMCPPkt_T
 * @brief LAN RMCP packet format.
**/
typedef struct
{
    MACHdr_T    MACHdr;
    uint16_t      FrameType;
    IPHdr_T     IPHdr;
    UDPHdr_T    UDPHdr;
    RMCPHdr_T   RMCPHdr;

}    LANRMCPPkt_T;


/**
 * @struct LANARPData_T
 * @brief ARP Request/Reply
**/
typedef struct
{
    uint16_t  HardType;
    uint16_t  ProtType;
    uint8_t   HardSize;
    uint8_t   ProtSize;
    uint16_t  Op;
    uint8_t   SenderMACAddr [MAC_ADDR_LEN];
    uint8_t   SenderIPAddr [IP_ADDR_LEN];
    uint8_t   TargetMACAddr [MAC_ADDR_LEN];
    uint8_t   TargetIPAddr [IP_ADDR_LEN];
    uint8_t   PAD [18];

}    LANARPData_T;


/**
 * @struct LANARPPkt_T
 * @brief LAN ARP Packet
**/
typedef struct
{
    MACHdr_T        MACHdr;
    uint16_t          FrameType;
    LANARPData_T    LANARPHdr;

}    LANARPPkt_T;


/**
 * @struct UDPPseudoHdr_T
 * @brief UDP Pseudo header - used in udp checksum calculation.
**/
typedef struct
{
    uint8_t   Protocol;
    uint8_t   SrcAddr  [IP_ADDR_LEN];
    uint8_t   DestAddr [IP_ADDR_LEN];
    uint16_t  UDPLen;

}    UDPPseudoHdr_T;

#pragma pack( )

#endif /* IPMI_LANIFC_H */
