#include "h/types.h"
#include "h/fddi.h"
#include "h/smc.h"
#include "h/smt_p.h"
#define KERNEL
#include "h/smtstate.h"
#ifndef SLIM_SMT
static int smt_authorize(struct s_smc *smc, struct smt_header *sm);
static int smt_check_set_count(struct s_smc *smc, struct smt_header *sm);
static const struct s_p_tab* smt_get_ptab(u_short para);
static int smt_mib_phys(struct s_smc *smc);
static int smt_set_para(struct s_smc *smc, struct smt_para *pa, int index,
int local, int set);
void smt_add_para(struct s_smc *smc, struct s_pcon *pcon, u_short para,
int index, int local);
static SMbuf *smt_build_pmf_response(struct s_smc *smc, struct smt_header *req,
int set, int local);
static int port_to_mib(struct s_smc *smc, int p);
#define MOFFSS(e) …
#define MOFFMS(e) …
#define MOFFAS(e) …
#define MOFFPS(e) …
#define AC_G …
#define AC_GR …
#define AC_S …
#define AC_NA …
#define AC_GROUP …
#define MS2BCLK(x) …
static const struct s_p_tab { … } p_tab[] = … ;
void smt_pmf_received_pack(struct s_smc *smc, SMbuf *mb, int local)
{ … }
static SMbuf *smt_build_pmf_response(struct s_smc *smc, struct smt_header *req,
int set, int local)
{ … }
static int smt_authorize(struct s_smc *smc, struct smt_header *sm)
{ … }
static int smt_check_set_count(struct s_smc *smc, struct smt_header *sm)
{ … }
void smt_add_para(struct s_smc *smc, struct s_pcon *pcon, u_short para,
int index, int local)
{ … }
static int smt_set_para(struct s_smc *smc, struct smt_para *pa, int index,
int local, int set)
{ … }
static const struct s_p_tab *smt_get_ptab(u_short para)
{ … }
static int smt_mib_phys(struct s_smc *smc)
{ … }
static int port_to_mib(struct s_smc *smc, int p)
{ … }
#ifdef DEBUG
#ifndef BOOT
void dump_smt(struct s_smc *smc, struct smt_header *sm, char *text)
{
int len ;
struct smt_para *pa ;
char *c ;
int n ;
int nn ;
#ifdef LITTLE_ENDIAN
int smtlen ;
#endif
SK_UNUSED(smc) ;
#ifdef DEBUG_BRD
if (smc->debug.d_smtf < 2)
#else
if (debug.d_smtf < 2)
#endif
return ;
#ifdef LITTLE_ENDIAN
smtlen = sm->smt_len + sizeof(struct smt_header) ;
#endif
printf("SMT Frame [%s]:\nDA ",text) ;
dump_hex((char *) &sm->smt_dest,6) ;
printf("\tSA ") ;
dump_hex((char *) &sm->smt_source,6) ;
printf(" Class %x Type %x Version %x\n",
sm->smt_class,sm->smt_type,sm->smt_version) ;
printf("TID %x\t\tSID ", sm->smt_tid);
dump_hex((char *) &sm->smt_sid,8) ;
printf(" LEN %x\n",sm->smt_len) ;
len = sm->smt_len ;
pa = (struct smt_para *) (sm + 1) ;
while (len > 0 ) {
int plen ;
#ifdef UNIX
printf("TYPE %x LEN %x VALUE\t",pa->p_type,pa->p_len) ;
#else
printf("TYPE %04x LEN %2x VALUE\t",pa->p_type,pa->p_len) ;
#endif
n = pa->p_len ;
if ( (n < 0 ) || (n > (int)(len - PARA_LEN))) {
n = len - PARA_LEN ;
printf(" BAD LENGTH\n") ;
break ;
}
#ifdef LITTLE_ENDIAN
smt_swap_para(sm,smtlen,0) ;
#endif
if (n < 24) {
dump_hex((char *)(pa+1),(int) n) ;
printf("\n") ;
}
else {
int first = 0 ;
c = (char *)(pa+1) ;
dump_hex(c,16) ;
printf("\n") ;
n -= 16 ;
c += 16 ;
while (n > 0) {
nn = (n > 16) ? 16 : n ;
if (n > 64) {
if (first == 0)
printf("\t\t\t...\n") ;
first = 1 ;
}
else {
printf("\t\t\t") ;
dump_hex(c,nn) ;
printf("\n") ;
}
n -= nn ;
c += 16 ;
}
}
#ifdef LITTLE_ENDIAN
smt_swap_para(sm,smtlen,1) ;
#endif
plen = (pa->p_len + PARA_LEN + 3) & ~3 ;
len -= plen ;
pa = (struct smt_para *)((char *)pa + plen) ;
}
printf("-------------------------------------------------\n\n") ;
}
void dump_hex(char *p, int len)
{
int n = 0 ;
while (len--) {
n++ ;
#ifdef UNIX
printf("%x%s",*p++ & 0xff,len ? ( (n & 7) ? " " : "-") : "") ;
#else
printf("%02x%s",*p++ & 0xff,len ? ( (n & 7) ? " " : "-") : "") ;
#endif
}
}
#endif
#endif
#endif