static void lsa_update_callback (struct in_addr ifaddr, struct in_addr area_id, u_char is_self_originated, struct lsa_header *lsa) { printf ("lsa_update_callback: "); printf ("ifaddr: %s ", inet_ntoa (ifaddr)); printf ("area: %s\n", inet_ntoa (area_id)); printf ("is_self_origin: %u\n", is_self_originated); /* It is important to note that lsa_header does indeed include the header and the LSA payload. To access the payload, first check the LSA type and then typecast lsa into the corresponding type, e.g.: if (lsa->type == OSPF_ROUTER_LSA) { struct router_lsa *rl = (struct router_lsa) lsa; ... u_int16_t links = rl->links; ... } */ ospf_lsa_header_dump (lsa); }
static void lsa_delete_callback (struct in_addr ifaddr, struct in_addr area_id, u_char is_self_originated, struct lsa_header *lsa) { printf ("lsa_delete_callback: "); printf ("ifaddr: %s ", inet_ntoa (ifaddr)); printf ("area: %s\n", inet_ntoa (area_id)); printf ("is_self_origin: %u\n", is_self_originated); ospf_lsa_header_dump (lsa); }
static void ospf_lsa_header_list_dump(struct stream *s, uint16_t length) { struct lsa_header *lsa; zlog_debug(" # LSA Headers %d", length / OSPF_LSA_HEADER_SIZE); /* LSA Headers. */ while (length > 0) { lsa = (struct lsa_header *)stream_pnt(s); ospf_lsa_header_dump(lsa); stream_forward_getp(s, OSPF_LSA_HEADER_SIZE); length -= OSPF_LSA_HEADER_SIZE; } }
static void ospf_packet_ls_upd_dump(struct stream *s, uint16_t length) { uint32_t sp; struct lsa_header *lsa; int lsa_len; uint32_t count; length -= OSPF_HEADER_SIZE; sp = stream_get_getp(s); count = stream_getl(s); length -= 4; zlog_debug("Link State Update"); zlog_debug(" # LSAs %d", count); while (length > 0 && count > 0) { if (length < OSPF_HEADER_SIZE || length % 4 != 0) { zlog_debug(" Remaining %d bytes; Incorrect length.", length); break; } lsa = (struct lsa_header *)stream_pnt(s); lsa_len = ntohs(lsa->length); ospf_lsa_header_dump(lsa); switch (lsa->type) { case OSPF_ROUTER_LSA: ospf_router_lsa_dump(s, length); break; case OSPF_NETWORK_LSA: ospf_network_lsa_dump(s, length); break; case OSPF_SUMMARY_LSA: case OSPF_ASBR_SUMMARY_LSA: ospf_summary_lsa_dump(s, length); break; case OSPF_AS_EXTERNAL_LSA: ospf_as_external_lsa_dump(s, length); break; case OSPF_AS_NSSA_LSA: ospf_as_external_lsa_dump(s, length); break; case OSPF_OPAQUE_LINK_LSA: case OSPF_OPAQUE_AREA_LSA: case OSPF_OPAQUE_AS_LSA: ospf_opaque_lsa_dump(s, length); break; default: break; } stream_forward_getp(s, lsa_len); length -= lsa_len; count--; } stream_set_getp(s, sp); }