2 * pcap2nbench - Converts libpcap network traces to nbench input
3 * Copyright (C) 2004 Jim McDonough <jmcd@us.ibm.com>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 3 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, see <http://www.gnu.org/licenses/>.
18 * Written by Anthony Liguori <aliguori@us.ibm.com>
21 #include <netinet/in.h>
25 smb::smb(const uint8_t *data, size_t length)
32 /* This code assumes Little Endian... Don't say I didn't warn you */
33 memcpy(&size, data + 2, 2);
34 memcpy(magic, data + 4, 4);
38 memcpy(&nt_status, data + 9, 4);
42 memcpy(&flags2, data + 14, 2);
43 memcpy(&pid_hi, data + 16, 2);
44 memcpy(signature, data + 18, 8);
45 memcpy(&reserved, data + 26, 2);
46 memcpy(&tid, data + 28, 2);
47 memcpy(&pid, data + 30, 2);
48 memcpy(&uid, data + 32, 2);
49 memcpy(&mid, data + 34, 2);
52 std::ostream &operator<<(std::ostream &lhs, const smb &rhs)
55 for (int i = 1; i < 4; i++) {
60 lhs << "Command: " << (uint16_t)rhs.command << std::endl
61 << "NT Status: " << rhs.nt_status << std::endl
62 << "Flags: " << (uint16_t)rhs.flags << std::endl
63 << "Flags2: " << rhs.flags2 << std::endl
64 << "Pid Hi: " << rhs.pid_hi << std::endl
65 << "Tid: " << rhs.tid << std::endl
66 << "Pid: " << rhs.pid << std::endl
67 << "Uid: " << rhs.uid << std::endl
68 << "Mid: " << rhs.mid << std::endl;