dsniff  2.4b2
About: A collection of tools for network auditing
  Fossies Dox: dsniff-2.4b2.tar.gz  ("inofficial" and yet experimental doxygen-generated source code documentation)  

decode_telnet.c
Go to the documentation of this file.
1 /*
2  * decode_telnet.c
3  *
4  * Telnet.
5  *
6  * Copyright (c) 2000 Dug Song <dugsong@monkey.org>
7  *
8  * $Id: decode_telnet.c,v 1.5 2001/03/15 08:33:03 dugsong Exp $
9  */
10 
11 #include "config.h"
12 
13 #include <sys/types.h>
14 
15 #include <stdio.h>
16 #include <string.h>
17 
18 #include "options.h"
19 #include "decode.h"
20 
21 int
22 decode_telnet(u_char *buf, int len, u_char *obuf, int olen)
23 {
24  if ((len = strip_telopts(buf, len)) == 0)
25  return (0);
26 
27  if (!is_ascii_string(buf, len))
28  return (0);
29 
30  if (strip_lines(buf, Opt_lines) < 2)
31  return (0);
32 
33  strlcpy(obuf, buf, olen);
34 
35  return (strlen(obuf));
36 }
37 
strip_telopts
int strip_telopts(u_char *buf, int len)
Definition: decode.c:110
strlcpy
size_t strlcpy(char *dst, const char *src, size_t siz)
Definition: strlcpy.c:43
is_ascii_string
int is_ascii_string(char *buf, int len)
Definition: decode.c:182
options.h
strip_lines
int strip_lines(char *buf, int max_lines)
Definition: decode.c:159
decode.h
Opt_lines
int Opt_lines
Definition: dsniff.c:43
buf
Definition: buf.h:14
decode_telnet
int decode_telnet(u_char *buf, int len, u_char *obuf, int olen)
Definition: decode_telnet.c:22
config.h
obuf
static char obuf[4096]
Definition: trigger.c:43