1 |
/* |
/* |
2 |
* Cisco 7200 (Predator) simulation platform. |
* Cisco router simulation platform. |
3 |
* Copyright (c) 2006 Christophe Fillot (cf@utc.fr) |
* Copyright (c) 2006 Christophe Fillot (cf@utc.fr) |
4 |
* |
* |
5 |
* Frame-Relay switch. |
* Frame-Relay switch. |
23 |
|
|
24 |
#define DEBUG_FRSW 0 |
#define DEBUG_FRSW 0 |
25 |
|
|
|
/* Number of LMI trailing bytes */ |
|
|
#define LMI_TRAILING_SIZE 3 |
|
|
|
|
26 |
extern FILE *log_file; |
extern FILE *log_file; |
27 |
|
|
28 |
/* ANSI LMI packet header */ |
/* ANSI LMI packet header */ |
59 |
frsw_conn_t *sc; |
frsw_conn_t *sc; |
60 |
u_int dlci; |
u_int dlci; |
61 |
|
|
62 |
if ((len <= (sizeof(lmi_ansi_hdr) + LMI_TRAILING_SIZE)) || |
if ((len <= sizeof(lmi_ansi_hdr)) || |
63 |
memcmp(pkt,lmi_ansi_hdr,sizeof(lmi_ansi_hdr))) |
memcmp(pkt,lmi_ansi_hdr,sizeof(lmi_ansi_hdr))) |
64 |
return(-1); |
return(-1); |
65 |
|
|
|
len -= LMI_TRAILING_SIZE; |
|
|
|
|
66 |
#if DEBUG_FRSW |
#if DEBUG_FRSW |
67 |
m_log(input->name,"received an ANSI LMI packet:\n"); |
m_log(input->name,"received an ANSI LMI packet:\n"); |
68 |
mem_dump(log_file,pkt,len); |
mem_dump(log_file,pkt,len); |
169 |
} |
} |
170 |
} |
} |
171 |
|
|
|
/* it seems that a trailing is required */ |
|
|
memset(pres,0,LMI_TRAILING_SIZE); |
|
|
pres += LMI_TRAILING_SIZE; |
|
172 |
rlen = pres - resp; |
rlen = pres - resp; |
173 |
|
|
174 |
#if DEBUG_FRSW |
#if DEBUG_FRSW |
438 |
|
|
439 |
/* Release NIOs */ |
/* Release NIOs */ |
440 |
frsw_release_vc(p); |
frsw_release_vc(p); |
441 |
mp_free(vc); |
mp_free(p); |
442 |
return(0); |
return(0); |
443 |
} |
} |
444 |
} |
} |