/* Copyright 1998 Acorn Computers Ltd
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
/*
*
*     LLC.H - Header for LLC Related exports
*
*     05-02-92 INH    Original
*
*/

/* Connection handle */

typedef int HCONN;


/* Physical network address */

typedef struct
{
  BYTE b[6];
}
  NETADDR;

/* Received Packet processing functions ***************** */

/* Receive functions are expected to dispose of the mbuf chains
   they are handed. Beware! The source address for a UI_RCV_PROC is
   a transient value only!
*/

typedef void (*UI_RCV_PROC) ( NETADDR *src, BUFCHAIN data, void *private );
typedef void (*LLC_RCV_PROC) ( HCONN hc, BUFCHAIN data, void *private );


/* Connection for LLC-level streams ******************** */

extern bool  LLC_Init ( void );
extern err_t LLC_AttachDriver ( char *drivername, const NETADDR *multi_hw );
extern void  LLC_Shutdown ( void );

/* UI (Datagram) service */

extern err_t UI_SetReceiver ( int SAP, UI_RCV_PROC RcvFn, void *private );
extern err_t UI_SendData ( NETADDR *dst, int SAP, BUFCHAIN pB );

/* LLC (Logical Link) service */

extern err_t LLC_SendData ( HCONN hc, BUFCHAIN data );

extern err_t LLC_OpenLink ( NETADDR *dst, int DSAP, LLC_RCV_PROC RcvFn,
            void *Private, HCONN *pHandleOut );

extern err_t LLC_CloseLink ( HCONN hc );

extern bool LLC_LinkOK ( HCONN hc );

extern int  LLC_GetMTU (void);

/* General */

extern void          LLC_BackgroundProcess(void);
extern NETADDR       LLC_MachineAddress;
extern volatile int  LLC_TickerTime;
/*extern int LLC_CallbackFn_handler(void);*/

/* Timers ------------- */

/* We implement a general-purpose timer library, which
   provides a 'safe' callback when a given timer has
   expired.
*/

typedef void (*pfnExpire) ( void *prvdata );

struct Timer
{
  struct Timer *next, *prev;
  int           status;
#define TMR_INACTIVE 0
#define TMR_ACTIVE   1
  int           expiretime;


  pfnExpire     expirefn;
  void *        prvdata;
};

extern void TimerInit
       ( struct Timer *pT, pfnExpire expire_fn, void *prvdata );

extern void TimerStart
       ( struct Timer *pT, int timeout );

extern void TimerClear
       ( struct Timer *pT );

#define TimerRunning(p) ((p)->status == TMR_ACTIVE)


/* Exports used by CMHG veneers */

/*
extern int CallbackFn_handler(void);
extern int TickerFn_handler ( _kernel_swi_regs *R, int pw );
extern int ReceiveFn_handler ( _kernel_swi_regs *R, int pw );












*/