/*****************************************************************************

 @(#) sdli_ioctl.h,v 0.7.8.1 2001/12/11 13:16:05 brian Exp

 -----------------------------------------------------------------------------

     Copyright (C) 1997-2001 OpenSS7 Corporation.  All Rights Reserved.


                                  PUBLIC LICENSE

     This license is provided without fee, provided that the above copy-
     right notice and this public license must be retained on all copies,
     extracts, compilations and derivative works.  Use or distribution of
     this work in a manner that restricts its use except as provided here
     will render this license void.

     The author(s) hereby waive any and all other restrictions in respect
     of their copyright in this software and its associated documentation.
     The authors(s) of this software place in the public domain any novel
     methods or processes which are embodied in this software.

     The author(s) undertook to write it for the sake of the advancement
     of the Arts and Sciences, but it is provided as is, and the author(s)
     will not take any responsibility in it.

 -----------------------------------------------------------------------------

 U.S. GOVERNMENT RESTRICTED RIGHTS.  If you are licensing this Software on
 behalf of the U.S. Government ("Government"), the following provisions apply
 to you.  If the Software is supplied by the Department of Defense ("DoD"), it
 is classified as "Commercial Computer Software" under paragraph 252.227-7014
 of the DoD Supplement to the Federal Acquisition Regulations ("DFARS") (or any
 successor regulations) and the Government is acquiring only the license rights
 granted herein (the license rights customarily provided to non-Government
 users).  If the Software is supplied to any unit or agency of the Government
 other than DoD, it is classified as "Restricted Computer Software" and the
 Government's rights in the Software are defined in paragraph 52.227-19 of the
 Federal Acquisition Regulations ("FAR") (or any success regulations) or, in
 the cases of NASA, in paragraph 18.52.227-86 of the NASA Supplement to the FAR
 (or any successor regulations).

 -----------------------------------------------------------------------------

 Last Modified 2001/12/11 13:16:05 by brian

 *****************************************************************************/

#ifndef __SDLI_IOCTL_H__
#define __SDLI_IOCTL_H__

#ident "@(#) SS7AlphaRelease(0.7.8.1) Copyright (c) 1997-2001 OpenSS7 Corporation."

#include <linux/ioctl.h>

#define SDL_IOC_MAGIC 'd'

/*
 *  PROTOCOL VARIANT AND OPTIONS
 */

#define SDL_IOCGOPTIONS _IOR(  SDL_IOC_MAGIC,  0, lmi_option_t )
#define SDL_IOCSOPTIONS _IOW(  SDL_IOC_MAGIC,  1, lmi_option_t )

/*
 *  CONFIGURATION
 */

typedef struct sdl_config {
    sdl_ulong   N;      /* octets per su in octet-counting mode */
    sdl_ulong   m;      /* maximum SIF size                     */
} sdl_config_t;

#define SDL_IOCGCONFIG  _IOR(  SDL_IOC_MAGIC,  2, sdl_config_t )
#define SDL_IOCSCONFIG  _IOWR( SDL_IOC_MAGIC,  3, sdl_config_t )
#define SDL_IOCTCONFIG  _IOWR( SDL_IOC_MAGIC,  4, sdl_config_t )
#define SDL_IOCCCONFIG  _IOR(  SDL_IOC_MAGIC,  5, sdl_config_t )

/*
 *  STATE
 */

typedef struct sdl_statem {
    sdl_ulong   daedt_state;
    sdl_ulong   daedr_state;
    sdl_ulong   octet_counting_mode;
} sdl_statem_t;

#define SDL_STATE_IDLE          0x00
#define SDL_STATE_IN_SERVICE    0x01

#define SDL_IOCGSTATEM  _IOR(  SDL_IOC_MAGIC,  6, sdl_statem_t )
#define SDL_IOCCMRESET  _IOR(  SDL_IOC_MAGIC,  7, sdl_statem_t )

/*
 *  STATISTICS
 */

typedef struct sdl_stats {
    lmi_ulong   header;
    sdl_ulong   rx_bytes;
    sdl_ulong   tx_bytes;
    sdl_ulong   rx_sus;
    sdl_ulong   tx_sus;
    sdl_ulong   rx_overruns;
    sdl_ulong   tx_underruns;
    sdl_ulong   rx_aborts;
    sdl_ulong   tx_aborts;
    sdl_ulong   rx_buffer_overflows;
    sdl_ulong   tx_buffer_overflows;
    sdl_ulong   rx_sus_in_error;            /* Q.752 Table 1.8  5,30 min */
    sdl_ulong   tx_sus_in_error;
    sdl_ulong   rx_sync_transitions;
    sdl_ulong   rx_bits_octet_counted;
    sdl_ulong   rx_crc_errors;
    sdl_ulong   rx_frame_errors;
    sdl_ulong   rx_frame_overflows;
    sdl_ulong   rx_frame_too_long;
    sdl_ulong   rx_frame_too_short;
    sdl_ulong   rx_residue_errors;
    sdl_ulong   rx_length_error;            /* error in length indicator */
    sdl_ulong   lead_cts_lost;
    sdl_ulong   lead_dcd_lost;
    sdl_ulong   carrier_lost;
} sdl_stats_t;

#define SDL_IOCGSTATSP  _IOR(  SDL_IOC_MAGIC,  8, sdl_stats_t  )
#define SDL_IOCSSTATSP  _IOWR( SDL_IOC_MAGIC,  9, sdl_stats_t  )
#define SDL_IOCGSTATS   _IOR(  SDL_IOC_MAGIC, 10, sdl_stats_t  )
#define SDL_IOCCSTATS   _IOW(  SDL_IOC_MAGIC, 11, sdl_stats_t  )

/*
 *  EVENTS
 */
typedef struct sdl_notify {
    sdl_ulong   sdl_notifications;
} sdl_notify_t;

#define SDL_EVT_LOST_SYNC   0x0000001
#define SDL_EVT_SU_ERROR    0x0000002
#define SDL_EVT_TX_FAIL     0x0000004
#define SDL_EVT_RX_FAIL     0x0000008

#define SDL_IOCGNOTIFY  _IOR(  SDL_IOC_MAGIC, 12, sdl_notify_t )
#define SDL_IOCSNOTIFY  _IOW(  SDL_IOC_MAGIC, 13, sdl_notify_t )
#define SDL_IOCCNOTIFY  _IOW(  SDL_IOC_MAGIC, 14, sdl_notify_t )

#define SDL_IOC_FIRST    0
#define SDL_IOC_LAST    14
#define SDL_IOC_PRIVATE 32

#endif  __SDLI_IOCTL_H__
