Move the GSM SMS dissection to a dedicated subdissector (currently still within
[obnox/wireshark/wip.git] / packet-dcerpc-butc.c
1 /* packet-dcerpc-butc.c
2  * Routines for butc dissection
3  * Copyright 2002, Jaime Fournier <jafour1@yahoo.com>
4  * This information is based off the released idl files from opengroup.
5  * ftp://ftp.opengroup.org/pub/dce122/dce/src/file.tar.gz bubasics/butc.idl
6  *      
7  * Ethereal - Network traffic analyzer
8  * By Gerald Combs <gerald@ethereal.com>
9  * Copyright 1998 Gerald Combs
10  *
11  * This program is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU General Public License
13  * as published by the Free Software Foundation; either version 2
14  * of the License, or (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, write to the Free Software
23  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
24  */
25
26 #ifdef HAVE_CONFIG_H
27 #include "config.h"
28 #endif
29
30
31 #ifdef HAVE_SYS_TYPES_H
32 #include <sys/types.h>
33 #endif
34
35 #include <string.h>
36
37 #include <glib.h>
38 #include <epan/packet.h>
39 #include "packet-dcerpc.h"
40
41 static int proto_butc = -1;
42 static int hf_butc_opnum = -1;
43
44
45 static gint ett_butc = -1;
46
47
48 static e_uuid_t uuid_butc = { 0x1d193c08, 0x000b, 0x11ca, { 0xba, 0x1d, 0x02, 0x60, 0x8c, 0x2e, 0xa9, 0x6e } };
49 static guint16  ver_butc = 4;
50
51
52 #define TC_DEFAULT_STACK_SIZE  (150*1024) /* stack size for tc threads */
53 #define TC_MAXGENNAMELEN  512      /* length of generic name */
54 #define TC_MAXDUMPPATH    256      /* dump path names*/
55 #define TC_MAXNAMELEN     128      /* name length */
56 #define TC_MAXFORMATLEN   100      /*size of the format statement */
57 #define TC_MAXHOSTLEN     128      /*for server/machine names */
58 #define TC_MAXTAPELEN     256      /*max tape name allowed */
59 #define TC_STAT_DONE      1        /* all done */
60 #define TC_STAT_OPRWAIT   2        /* waiting for user interaction */
61 #define TC_STAT_DUMP      4        /* true if dump, false if restore */
62 #define TC_STAT_ABORTED   8        /* the operation was aborted */
63 #define TC_STAT_ERROR     16       /* error ocuured in the operation */
64 #define TSK_STAT_FIRST    0x1      /* get id of first task */
65 #define TSK_STAT_END      0x2     /* no more tasks */
66 #define TSK_STAT_NOTFOUND 0x4      /* couldn't find task id requested */
67
68 #define TCOP_NONE             0
69 #define TCOP_READLABEL        1
70 #define TCOP_LABELTAPE        2
71 #define TCOP_DUMP             3
72 #define TCOP_RESTORE          4
73 #define TCOP_SCANTAPE         5
74 #define TCOP_SAVEDB           6
75 #define TCOP_RESTOREDB        7
76 #define TCOP_STATUS           8
77 #define TCOP_SPARE            9
78
79
80 static dcerpc_sub_dissector butc_dissectors[] = {
81         { 0, "PerformDump", NULL, NULL},
82         { 1, "PerformRestore", NULL, NULL},
83         { 2, "AbortDump", NULL, NULL},
84         { 3, "LabelTape", NULL, NULL},
85         { 4, "ReadLabel", NULL, NULL},
86         { 5, "ScanDumps", NULL, NULL},
87         { 6, "TCInfo", NULL, NULL},
88         { 7, "SaveDb", NULL, NULL},
89         { 8, "RestoreDb", NULL, NULL},
90         { 9, "EndStatus", NULL, NULL},
91         { 10, "GetStatus", NULL, NULL},
92         { 11, "RequestAbort", NULL, NULL},
93         { 12, "ScanStatus", NULL, NULL},
94         { 13, "GetServerInterfaces", NULL, NULL},
95         { 0, NULL, NULL, NULL }
96 };
97
98 void
99 proto_register_butc (void)
100 {
101         static hf_register_info hf[] = {
102         { &hf_butc_opnum,
103                 { "Operation", "butc.opnum", FT_UINT16, BASE_DEC, NULL, 0x0, "Operation", HFILL }},
104         };
105
106         static gint *ett[] = {
107                 &ett_butc,
108         };
109         proto_butc = proto_register_protocol ("DCE/RPC BUTC", "BUTC", "butc");
110         proto_register_field_array (proto_butc, hf, array_length (hf));
111         proto_register_subtree_array (ett, array_length (ett));
112 }
113
114 void
115 proto_reg_handoff_butc (void)
116 {
117         /* Register the protocol as dcerpc */
118         dcerpc_init_uuid (proto_butc, ett_butc, &uuid_butc, ver_butc, butc_dissectors, hf_butc_opnum);
119 }