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_napster.c
Go to the documentation of this file.
1
/*
2
* decode_napster.c
3
*
4
* Napster. w00w00!
5
*
6
* Copyright (c) 2000 Dug Song <dugsong@monkey.org>
7
*
8
* $Id: decode_napster.c,v 1.6 2001/03/15 08:33:01 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 "
buf.h
"
19
#include "
decode.h
"
20
21
int
22
decode_napster
(u_char *
buf
,
int
len, u_char *
obuf
,
int
olen)
23
{
24
struct
buf
inbuf, outbuf;
25
u_short i, type;
26
27
buf_init
(&inbuf,
buf
, len);
28
buf_init
(&outbuf,
obuf
, olen);
29
30
if
(
buf_get
(&inbuf, &i,
sizeof
(i)) !=
sizeof
(i))
31
return
(0);
32
33
i =
pletohs
(&i);
34
35
if
(
buf_get
(&inbuf, &type,
sizeof
(type)) !=
sizeof
(type))
36
return
(0);
37
38
type =
pletohs
(&type);
39
40
if
(type != 2 || i >
buf_len
(&inbuf))
41
return
(0);
42
43
buf_put
(&outbuf,
buf_ptr
(&inbuf), i);
44
buf_put
(&outbuf,
"\n"
, 1);
45
46
buf_end
(&outbuf);
47
48
return
(
buf_len
(&outbuf));
49
}
50
decode_napster
int decode_napster(u_char *buf, int len, u_char *obuf, int olen)
Definition:
decode_napster.c:22
buf_init
void buf_init(buf_t buf, u_char *data, int len)
Definition:
buf.c:24
buf_end
void buf_end(buf_t buf)
Definition:
buf.c:121
buf_put
int buf_put(buf_t buf, void *src, int len)
Definition:
buf.c:93
decode.h
buf.h
buf
Definition:
buf.h:14
buf_get
int buf_get(buf_t buf, void *dst, int len)
Definition:
buf.c:74
buf_ptr
#define buf_ptr(b)
Definition:
buf.h:31
config.h
obuf
static char obuf[4096]
Definition:
trigger.c:43
buf_len
#define buf_len(b)
Definition:
buf.h:34
pletohs
#define pletohs(p)
Definition:
decode.h:24
decode_napster.c
Generated by
1.8.16