/*     
 * $RCSfile: conc_internal.h,v $
 *
 * x-kernel v3.3
 *
 * Copyright (c) 1993,1991,1990,1996  Arizona Board of Regents
 */

#include "xkernel.h"
#include "ip.h"
#include "conc.h"

/* CONC message header definition */

typedef struct header {
    CONCport sport;  /* source port      */
    CONCport dport;  /* destination port */
    u_short ulen;   /* CONC length       */
} CONChdr;

#define HLEN (sizeof(CONChdr))

/* protocol and session states */

typedef struct pstate {
    Map activemap;
    Map passivemap;
} ProtlState;

typedef struct sstate {
    CONChdr hdr;
} SessnState;

/* active and passive maps */

typedef struct {
    Sessn   lls;
    CONCport localport;
    CONCport remoteport;
} ActiveId;

typedef CONCport PassiveId;

#define ACTIVE_MAP_SIZE  101
#define PASSIVE_MAP_SIZE 23

/* UPI function declarations */

void            conc_init(Protl);
static Sessn    concOpen(Protl, Protl, Protl, Part *);
static XkReturn concOpenEnable(Protl, Protl, Protl, Part *);
static XkReturn concDemux(Protl, Sessn, Msg *);
static XkHandle concPush(Sessn, Msg *);
static XkReturn concPop(Sessn, Sessn, Msg *, void *);
static Sessn    concCreateSessn(Protl, Protl, Protl, ActiveId *);
static XkReturn concClose(Sessn);
static int      concControlProtl(Protl, int, char *, int) ;
static int      concControlSessn(Sessn, int, char *, int) ;
static Part    *concGetParticipants(Sessn);

/* internal function declarations */

static void     getproc_protl(Protl);
static void     getproc_sessn(Sessn);
static long     concHdrLoad(CONChdr *, char *, long);
static void     concHdrStore(CONChdr *, char *, long);

/* trace variable used in conjunction with xTrace stmts */
int traceconcp;
