5 /********************************************************************************
9 * Utility to convert an ASCII hexdump into a libpcap-format capture file
11 * (c) Copyright 2001 Ashok Narayanan <ashokn@cisco.com>
13 * $Id: text2pcap-scanner.l,v 1.3 2001/11/24 09:46:28 guy Exp $
15 * Ethereal - Network traffic analyzer
16 * By Gerald Combs <gerald@ethereal.com>
17 * Copyright 1998 Gerald Combs
21 * This program is free software; you can redistribute it and/or
22 * modify it under the terms of the GNU General Public License
23 * as published by the Free Software Foundation; either version 2
24 * of the License, or (at your option) any later version.
26 * This program is distributed in the hope that it will be useful,
27 * but WITHOUT ANY WARRANTY; without even the implied warranty of
28 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
29 * GNU General Public License for more details.
31 * You should have received a copy of the GNU General Public License
32 * along with this program; if not, write to the Free Software
33 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
35 *******************************************************************************/
40 #include "text2pcap.h"
45 directive #TEXT2PCAP.*
47 byte [0-9A-Fa-f][0-9A-Fa-f][ \t]
48 byte_eol [0-9A-Fa-f][0-9A-Fa-f]\n
49 offset [0-9A-Fa-f]+[: \t]
50 offset_eol [0-9A-Fa-f]+\n
57 {byte} { parse_token(T_BYTE, yytext); }
58 {byte_eol} { parse_token(T_BYTE, yytext); parse_token(T_EOL, NULL); }
59 {offset} { parse_token(T_OFFSET, yytext); }
60 {offset_eol} { parse_token(T_OFFSET, yytext); parse_token(T_EOL, NULL); }
61 {mailfwd}{offset} { parse_token(T_OFFSET, yytext+1); }
62 {eol} { parse_token(T_EOL, NULL); }
63 [ \t] ; /* ignore whitespace */
64 {directive} { parse_token(T_DIRECTIVE, yytext); }
65 {comment} ; /* ignore comments */
66 {text} { parse_token(T_TEXT, yytext); }