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

 @(#) sdli.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_H__
#define __SDLI_H__

#ident "@(#) SS7AlphaRelease(0.7.8.1) Copyright (c) 1997-2001 OpenSS7 Corporation."
/*
 *  The purpose of the SDL interface is to provide separation between the
 *  SDTI (Signalling Data Terminal Interface) which provides SS7 Signalling
 *  Data Terminal (SDT) state machine services including AERM, SUERM and
 *  EIM, and the underlying driver which provides essentially HDLC
 *  capabilities (DAEDR and DAEDT).  The interface utilizes some FISU/LSSU
 *  compression techniques to increase the performance of the interface.
 */

typedef lmi_long    sdl_long;
typedef lmi_ulong   sdl_ulong;
typedef lmi_ushort  sdl_ushort;
typedef lmi_uchar   sdl_uchar;

#define SDL_PROTO_BASE                     16L

#define SDL_DSTR_FIRST                     ( 1L + SDL_PROTO_BASE)
#define SDL_DAEDT_TRANSMISSION_REQ         ( 1L + SDL_PROTO_BASE)
#define SDL_DAEDT_START_REQ                ( 2L + SDL_PROTO_BASE)
#define SDL_DAEDR_START_REQ                ( 3L + SDL_PROTO_BASE)
#define SDL_DSTR_LAST                      ( 3L + SDL_PROTO_BASE)

#define SDL_USTR_LAST                      (-1L - SDL_PROTO_BASE)
#define SDL_DAEDR_RECEIVED_BITS_IND        (-1L - SDL_PROTO_BASE)
#define SDL_DAEDR_CORRECT_SU_IND           (-2L - SDL_PROTO_BASE)
#define SDL_DAEDR_SU_IN_ERROR_IND          (-3L - SDL_PROTO_BASE)
#define SDL_DAEDT_TRANSMISSION_REQUEST_IND (-4L - SDL_PROTO_BASE)
#define SDL_USTR_FIRST                     (-4L - SDL_PROTO_BASE)

/*
 *  SDLI PROTOCOL PRIMITIVES
 */

/*
 *  SDL_DAEDR_RECEIVED_BITS_IND, M_PROTO, M_PCPROTO or M_DATA
 */
typedef struct {
    sdl_long    sdl_primitive;  /* SDL_DAEDR_RECEIVED_BITS_IND */
    sdl_ulong   sdl_count;
} sdl_daedr_received_bits_ind_t;

/*
 *  SDL_DAEDR_START_REQ, M_PROTO or M_PCPROTO
 */
typedef struct {
    sdl_long    sdl_primitive;  /* SDL_DAEDR_START_REQ */
} sdl_daedr_start_req_t;

/*
 *  SDL_DAEDR_CORRECT_SU_IND, M_PROTO or M_PCPROTO
 */
typedef struct {
    sdl_long    sdl_primitive;  /* SDL_DAEDR_CORRECT_SU_IND */
    sdl_ulong   sdl_count;
} sdl_daedr_correct_su_ind_t;

/*
 *  SDL_DAEDR_SU_IN_ERROR_IND, M_PROTO or M_PCPROTO
 */
typedef struct {
    sdl_long    sdl_primitive;  /* SDL_DAEDR_SU_IN_ERROR_IND */
} sdl_daedr_su_in_error_ind_t;

/*
 *  SDL_DAEDT_START_REQ, M_PROTO or M_PCPROTO
 */
typedef struct {
    sdl_long    sdl_primitive;  /* SDL_DAEDT_START_REQ */
} sdl_daedt_start_req_t;

/*
 *  SDL_DAEDT_TRANSMISSION_REQ, M_PROTO, M_PCPROTO or M_DATA
 */
typedef struct {
    sdl_long    sdl_primitive;  /* SDL_DAEDT_TRANSMISSION_REQ */
} sdl_daedt_transmission_req_t;

/*
 *  SDL_DAEDT_TRANSMISSION_REQUEST_IND, M_PROTO, M_PCPROTO
 */
typedef struct {
    sdl_long    sdl_primitive;  /* SDL_DAEDT_TRANSMISSSION_REQUEST_IND */
} sdl_daedt_transmission_request_ind_t;

union SDL_primitives {
    sdl_long                                sdl_primitive;
    sdl_daedr_received_bits_ind_t           daedr_received_bits_ind;
    sdl_daedr_start_req_t                   daedr_start_req;
    sdl_daedr_correct_su_ind_t              daedr_correct_su_ind;
    sdl_daedr_su_in_error_ind_t             daedr_su_in_error_ind;
    sdl_daedt_start_req_t                   daedt_start_req;
    sdl_daedt_transmission_req_t            daedt_transmission_req;
    sdl_daedt_transmission_request_ind_t    daedt_transmission_request_ind;
};

#define SDL_DAEDR_RECEIVED_BITS_IND_SIZE        sizeof(sdl_daedr_received_bits_ind_t)
#define SDL_DAEDR_START_REQ_SIZE                sizeof(sdl_daedr_start_req_t)
#define SDL_DAEDR_CORRECT_SU_IND_SIZE           sizeof(sdl_daedr_correct_su_ind_t)
#define SDL_DAEDR_SU_IN_ERROR_IND_SIZE          sizeof(sdl_daedr_su_in_error_ind_t)
#define SDL_DAEDT_START_REQ_SIZE                sizeof(sdl_daedt_start_req_t)
#define SDL_DAEDT_TRANSMISSION_REQ_SIZE         sizeof(sdl_daedt_transmission_req_t)
#define SDL_DAEDT_TRANSMISSION_REQUEST_IND_SIZE sizeof(sdl_daedt_transmission_request_ind_t)

#endif  __SDLI_H__
