/**************************************************************************** 
** File: l2tp.h
**
** Author: Mike Borella
**
** Comments: Structure of L2TP packets
**
** $Log$
*****************************************************************************/

#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>

/*
 * Control message types 
 */

char *CtrlMsgType[17] =
{
  "",
  "Start Ctrl Conn Request",
  "Start Ctrl Conn Reply",
  "Start Ctrl Conn Connected",
  "Stop Ctrl Conn Notification",
  "(Reserved)",
  "Hello",
  "Outgoing Call Request",
  "Outgoing Call Reply",
  "Outgoing Call Connected",
  "Incoming Call Request",
  "Incoming Call Reply",
  "Incoming Call Connected",
  "(Reserved)",
  "Call Disconnect Notify",
  "WAN Error Notify",
  "Set Link Info"
};


/*
 * Message type AVP (generic part)
 */

typedef struct _L2TP_AVP
{
#if defined(WORDS_BIGENDIAN)
  u_int16_t m:1,
            h:1,
            zeros:4,
            length:10;
#else
  u_int16_t length:10,
            zeros:4,
            h:1,
            m:1;
#endif
  u_int16_t vendorID;
  u_int16_t attribute;
} L2TP_AVP;


/*
 * L2TP control Header (generic part)
 */

typedef struct _L2TPCtrlHdr
{
  u_int8_t bits;
  u_int8_t version;
  u_int16_t length;
  u_int16_t tunnelID;
  u_int16_t callID;
  u_int16_t ns;
  u_int16_t nr;
} L2TPCtrlHdr;
