2 * OSPFd dump routine (parts used by ospfclient).
3 * Copyright (C) 1999, 2000 Toshiaki Takada
5 * This file is part of FRRouting (FRR).
7 * FRR is free software; you can redistribute it and/or modify it under the
8 * terms of the GNU General Public License as published by the Free Software
9 * Foundation; either version 2, or (at your option) any later version.
11 * FRR is distributed in the hope that it will be useful, but WITHOUT ANY
12 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
16 * You should have received a copy of the GNU General Public License along
17 * with FRR; see the file COPYING. If not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26 #include "ospf_dump_api.h"
28 #include "ospf_asbr.h"
33 const struct message ospf_ism_state_msg
[] =
35 { ISM_DependUpon
, "DependUpon" },
37 { ISM_Loopback
, "Loopback" },
38 { ISM_Waiting
, "Waiting" },
39 { ISM_PointToPoint
, "Point-To-Point" },
40 { ISM_DROther
, "DROther" },
41 { ISM_Backup
, "Backup" },
44 const int ospf_ism_state_msg_max
= OSPF_ISM_STATE_MAX
;
46 const struct message ospf_nsm_state_msg
[] =
48 { NSM_DependUpon
, "DependUpon" },
49 { NSM_Deleted
, "Deleted" },
51 { NSM_Attempt
, "Attempt" },
53 { NSM_TwoWay
, "2-Way" },
54 { NSM_ExStart
, "ExStart" },
55 { NSM_Exchange
, "Exchange" },
56 { NSM_Loading
, "Loading" },
59 const int ospf_nsm_state_msg_max
= OSPF_NSM_STATE_MAX
;
61 const struct message ospf_lsa_type_msg
[] =
63 { OSPF_UNKNOWN_LSA
, "unknown" },
64 { OSPF_ROUTER_LSA
, "router-LSA" },
65 { OSPF_NETWORK_LSA
, "network-LSA" },
66 { OSPF_SUMMARY_LSA
, "summary-LSA" },
67 { OSPF_ASBR_SUMMARY_LSA
, "summary-LSA" },
68 { OSPF_AS_EXTERNAL_LSA
, "AS-external-LSA" },
69 { OSPF_GROUP_MEMBER_LSA
, "GROUP MEMBER LSA" },
70 { OSPF_AS_NSSA_LSA
, "NSSA-LSA" },
72 { OSPF_OPAQUE_LINK_LSA
, "Link-Local Opaque-LSA" },
73 { OSPF_OPAQUE_AREA_LSA
, "Area-Local Opaque-LSA" },
74 { OSPF_OPAQUE_AS_LSA
, "AS-external Opaque-LSA" },
76 const int ospf_lsa_type_msg_max
= OSPF_MAX_LSA
;
78 const struct message ospf_link_state_id_type_msg
[] =
80 { OSPF_UNKNOWN_LSA
, "(unknown)" },
81 { OSPF_ROUTER_LSA
, "" },
82 { OSPF_NETWORK_LSA
, "(address of Designated Router)" },
83 { OSPF_SUMMARY_LSA
, "(summary Network Number)" },
84 { OSPF_ASBR_SUMMARY_LSA
, "(AS Boundary Router address)" },
85 { OSPF_AS_EXTERNAL_LSA
, "(External Network Number)" },
86 { OSPF_GROUP_MEMBER_LSA
, "(Group membership information)" },
87 { OSPF_AS_NSSA_LSA
, "(External Network Number for NSSA)" },
88 { 8, "(Type-8 LSID)" },
89 { OSPF_OPAQUE_LINK_LSA
, "(Link-Local Opaque-Type/ID)" },
90 { OSPF_OPAQUE_AREA_LSA
, "(Area-Local Opaque-Type/ID)" },
91 { OSPF_OPAQUE_AS_LSA
, "(AS-external Opaque-Type/ID)" },
93 const int ospf_link_state_id_type_msg_max
= OSPF_MAX_LSA
;
95 const struct message ospf_network_type_msg
[] =
97 { OSPF_IFTYPE_NONE
, "NONE" },
98 { OSPF_IFTYPE_POINTOPOINT
, "Point-to-Point" },
99 { OSPF_IFTYPE_BROADCAST
, "Broadcast" },
100 { OSPF_IFTYPE_NBMA
, "NBMA" },
101 { OSPF_IFTYPE_POINTOMULTIPOINT
, "Point-to-MultiPoint" },
102 { OSPF_IFTYPE_VIRTUALLINK
, "Virtual-Link" },
104 const int ospf_network_type_msg_max
= OSPF_IFTYPE_MAX
;
107 const struct message ospf_auth_type_str
[] =
109 { OSPF_AUTH_NULL
, "Null" },
110 { OSPF_AUTH_SIMPLE
, "Simple" },
111 { OSPF_AUTH_CRYPTOGRAPHIC
, "Cryptographic" },
113 const size_t ospf_auth_type_str_max
= sizeof (ospf_auth_type_str
) /
114 sizeof (ospf_auth_type_str
[0]);
116 #define OSPF_OPTION_STR_MAXLEN 24
119 ospf_options_dump (u_char options
)
121 static char buf
[OSPF_OPTION_STR_MAXLEN
];
123 snprintf (buf
, OSPF_OPTION_STR_MAXLEN
, "*|%s|%s|%s|%s|%s|%s|%s",
124 (options
& OSPF_OPTION_O
) ? "O" : "-",
125 (options
& OSPF_OPTION_DC
) ? "DC" : "-",
126 (options
& OSPF_OPTION_EA
) ? "EA" : "-",
127 (options
& OSPF_OPTION_NP
) ? "N/P" : "-",
128 (options
& OSPF_OPTION_MC
) ? "MC" : "-",
129 (options
& OSPF_OPTION_E
) ? "E" : "-",
130 (options
& OSPF_OPTION_MT
) ? "M/T" : "-");
136 ospf_lsa_header_dump (struct lsa_header
*lsah
)
138 const char *lsah_type
= LOOKUP (ospf_lsa_type_msg
, lsah
->type
);
140 zlog_debug (" LSA Header");
141 zlog_debug (" LS age %d", ntohs (lsah
->ls_age
));
142 zlog_debug (" Options %d (%s)", lsah
->options
,
143 ospf_options_dump (lsah
->options
));
144 zlog_debug (" LS type %d (%s)", lsah
->type
,
145 (lsah
->type
? lsah_type
: "unknown type"));
146 zlog_debug (" Link State ID %s", inet_ntoa (lsah
->id
));
147 zlog_debug (" Advertising Router %s", inet_ntoa (lsah
->adv_router
));
148 zlog_debug (" LS sequence number 0x%lx", (u_long
)ntohl (lsah
->ls_seqnum
));
149 zlog_debug (" LS checksum 0x%x", ntohs (lsah
->checksum
));
150 zlog_debug (" length %d", ntohs (lsah
->length
));