home *** CD-ROM | disk | FTP | other *** search
/ Power Hacker 2003 / Power_Hacker_2003.iso / Exploit and vulnerability / w00w00 / sectools / dsniff / decode_ospf.c < prev    next >
Encoding:
C/C++ Source or Header  |  2000-05-18  |  456 b   |  30 lines

  1. /*
  2.   decode_ospf.c
  3.  
  4.   Open Shortest Path First.
  5.   
  6.   Copyright (c) 2000 Dug Song <dugsong@monkey.org>
  7.  
  8.   $Id: decode_ospf.c,v 1.2 2000/05/18 23:52:35 dugsong Exp $
  9. */
  10.  
  11. #include <sys/types.h>
  12. #include <stdio.h>
  13. #include <string.h>
  14. #include "decode.h"
  15.  
  16. int
  17. decode_ospf(u_char *buf, int len)
  18. {
  19.     if (len < 25)
  20.         return (0);
  21.     
  22.     if (ntohs(*(u_short *)&buf[14]) != 1)
  23.         return (0);
  24.     
  25.     buf[24] = '\0';
  26.     
  27.     return (snprintf(Buf, sizeof(Buf), "%s\n", buf + 16));
  28. }
  29.  
  30.