Add ``show layers'' to see the protocol layering for a link.

This commit is contained in:
brian 1999-05-15 02:24:18 +00:00
parent c56c296921
commit 69c6034fcb
3 changed files with 24 additions and 4 deletions

View File

@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* $Id: command.c,v 1.192 1999/05/08 11:06:21 brian Exp $
* $Id: command.c,v 1.193 1999/05/12 09:48:44 brian Exp $
*
*/
#include <sys/param.h>
@ -143,7 +143,7 @@
#define NEG_DNS 52
const char Version[] = "2.21";
const char VersionDate[] = "$Date: 1999/05/08 11:06:21 $";
const char VersionDate[] = "$Date: 1999/05/12 09:48:44 $";
static int ShowCommand(struct cmdargs const *);
static int TerminalCommand(struct cmdargs const *);
@ -757,6 +757,8 @@ static struct cmdtab const ShowCommands[] = {
"Interface status", "show iface"},
{"ipcp", NULL, ipcp_Show, LOCAL_AUTH,
"IPCP status", "show ipcp"},
{"layers", NULL, link_ShowLayers, LOCAL_AUTH | LOCAL_CX_OPT,
"Protocol layers", "show layers"},
{"lcp", NULL, lcp_ReportStatus, LOCAL_AUTH | LOCAL_CX,
"LCP status", "show lcp"},
{"link", "datalink", datalink_Show, LOCAL_AUTH | LOCAL_CX,

View File

@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: link.c,v 1.9 1999/05/08 11:06:58 brian Exp $
* $Id: link.c,v 1.10 1999/05/12 09:48:51 brian Exp $
*
*/
@ -64,6 +64,7 @@
#include "pap.h"
#include "chap.h"
#include "cbcp.h"
#include "command.h"
static void Despatch(struct bundle *, struct link *, struct mbuf *, u_short);
@ -339,3 +340,18 @@ Despatch(struct bundle *bundle, struct link *l, struct mbuf *bp, u_short proto)
mbuf_Free(bp);
}
}
int
link_ShowLayers(struct cmdargs const *arg)
{
struct link *l = command_ChooseLink(arg);
int layer;
for (layer = l->nlayers; layer; layer--)
prompt_Printf(arg->prompt, "%s%s", layer == l->nlayers ? "" : ", ",
l->layer[layer - 1]->name);
if (l->nlayers)
prompt_Printf(arg->prompt, "\n");
return 0;
}

View File

@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: link.h,v 1.4 1998/08/25 17:48:42 brian Exp $
* $Id: link.h,v 1.5 1999/05/08 11:07:00 brian Exp $
*
*/
@ -36,6 +36,7 @@
struct bundle;
struct prompt;
struct cmdargs;
struct link {
int type; /* _LINK type */
@ -73,3 +74,4 @@ extern void link_EmptyStack(struct link *);
#define PROTO_OUT 2
extern void link_ProtocolRecord(struct link *, u_short, int);
extern void link_ReportProtocolStatus(struct link *, struct prompt *);
extern int link_ShowLayers(struct cmdargs const *);