summaryrefslogtreecommitdiffstats
path: root/epan/dissectors/pidl/CMakeLists.txt
blob: 556f6622eb93da2addb44a6e4fb99eb5d60e57a2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
# CMakeLists.txt
#
# Wireshark - Network traffic analyzer
# By Gerald Combs <gerald@wireshark.org>
# Copyright 1998 Gerald Combs
#
# SPDX-License-Identifier: GPL-2.0-or-later
#

set(PIDL_DISSECTOR_NAMES
	atsvc
	browser
	clusapi
	dnsserver
	dfs
	drsuapi
	dssetup
	efs
	eventlog
	frsrpc
	frstrans
	fsrvp
	initshutdown
	iwbemlevel1login
	iwbemloginclientid
	iwbemloginclientidex
	iwbemservices
	lsa
	mapi
	mdssvc
	misc
	nspi
	rfr
	samr
	srvsvc
	svcctl
	winreg
	winspool
	witness
	wkssvc
	wzcsvc
)

#
# These can give some (not-fatal) errors building from source:
#
# dnsserver - "dnsserver.idl:159: error: Inline arrays not supported"
# eventlog - "eventlog.idl:54: error: Inline arrays not supported"
# nspi - "nspi.idl:154: error: Syntax error near '/'"
# mapi - includes nspi.idl, so it gets the above error
# winspool - we have a hand-written spoolss dissector we use instead of spoolss.idl
#
# XXX - the "Syntax error near '/'" errors show up if cpp doesn't strip
# C99/C++ comments and the file in question - nspi.idl - contains
# C99/C++ comments, because the parser runs cpp, by default, to strip
# comments and proccess #includes.  Those errors may cause
# packet-dcerpc-nspi.c, and possibly packet-dcerpc-mapi.c not to be
# generated.  GCC's cpp appears to strip them by default, but Xcode's
# cpp, at least as of Xcode 15.2, does not - cc -E does, however,
# strip them.  (Both of them strip "classic C" /* ... */ comments.)
#

set(PIDL_DISSECTOR_browser_EXTRA_DEPS
	srvsvc/srvsvc.idl
)
set(PIDL_DISSECTOR_clusapi_EXTRA_DEPS
	winreg/winreg.idl
	misc/misc.idl
)
set(PIDL_DISSECTOR_drsuapi_EXTRA_DEPS
	misc/misc.idl
	lsa/lsa.idl
	samr/samr.idl
)
set(PIDL_DISSECTOR_dssetup_EXTRA_DEPS
	misc/misc.idl
)
set(PIDL_DISSECTOR_eventlog_EXTRA_DEPS
	idl_types.h
)
set(PIDL_DISSECTOR_frsrpc_EXTRA_DEPS
	misc/misc.idl
	idl_types.h
)
set(PIDL_DISSECTOR_frstrans_EXTRA_DEPS
	misc/misc.idl
	idl_types.h
)
set(PIDL_DISSECTOR_fsrvp_EXTRA_DEPS
	idl_types.h
)
set(PIDL_DISSECTOR_initshutdown_EXTRA_DEPS
	lsa/lsa.idl
	idl_types.h
)
set(PIDL_DISSECTOR_iwbemlevel1login_EXTRA_DEPS
	idl_types.h
)
set(PIDL_DISSECTOR_iwbemloginclientid_EXTRA_DEPS
	idl_types.h
)
set(PIDL_DISSECTOR_iwbemloginclientidex_EXTRA_DEPS
	idl_types.h
)
set(PIDL_DISSECTOR_iwbemservices_EXTRA_DEPS
	idl_types.h
)
set(PIDL_DISSECTOR_lsa_EXTRA_DEPS
	idl_types.h
)
set(PIDL_DISSECTOR_mapi_EXTRA_DEPS
	idl_types.h
	nspi/nspi.idl
	mapicodes_enum.h
	mapitags_enum.h
)
set(PIDL_DISSECTOR_mdssvc_EXTRA_DEPS
	misc/misc.idl
)
set(PIDL_DISSECTOR_misc_EXTRA_DEPS
	idl_types.h
)
set(PIDL_DISSECTOR_nspi_EXTRA_DEPS
	idl_types.h
	mapicodes_enum.h
	mapitags_enum.h
)
set(PIDL_DISSECTOR_rfr_EXTRA_DEPS
	idl_types.h
	mapicodes_enum.h
)
set(PIDL_DISSECTOR_samr_EXTRA_DEPS
	idl_types.h
	misc/misc.idl
	lsa/lsa.idl
)
set(PIDL_DISSECTOR_srvsvc_EXTRA_DEPS
	idl_types.h
)
set(PIDL_DISSECTOR_winreg_EXTRA_DEPS
	misc/misc.idl
)
set(PIDL_DISSECTOR_winspool_EXTRA_DEPS
	idl_types.h
	misc/misc.idl
	winreg/winreg.idl
	# Wireshark supplies the spoolss elements through a hand-written dissector
	#spoolss/spoolss.idl
)
set(PIDL_DISSECTOR_witness_EXTRA_DEPS
	misc/misc.idl
	idl_types.h
)
set(PIDL_DISSECTOR_wkssvc_EXTRA_DEPS
	lsa/lsa.idl
	srvsvc/srvsvc.idl
	idl_types.h
)

set(PIDL_DISSECTOR_TARGETS)

foreach(PROTOCOL_NAME IN LISTS PIDL_DISSECTOR_NAMES)
	#
	# Construct, from the list of extra dependencies for
	# this dissector, a list of --includedir options
	# for all the directories in which those dependencies
	# reside. We add --includedir .. for all targets.
	#
	set(INCLUDE_DIRS "")
	list(APPEND INCLUDE_DIRS --includedir ..)
	foreach(DEPENDENCY in ${PIDL_DISSECTOR_${PROTOCOL_NAME}_EXTRA_DEPS})
		get_filename_component(PARENT_DIR ${DEPENDENCY} DIRECTORY)
		if (NOT PARENT_DIR STREQUAL "")
			list(APPEND INCLUDE_DIRS  --includedir ../${PARENT_DIR})
		endif()
	endforeach()
	#
	# COMMAND_EXPAND_LISTS is required to cause the list
	# INCLUDE_DIRS to be expanded into a set of individual
	# arguments to the pidl command.
	#
	add_custom_command(
		OUTPUT packet-dcerpc-${PROTOCOL_NAME}-stamp
		COMMAND "${PERL_EXECUTABLE}"
			"${CMAKE_SOURCE_DIR}/tools/pidl/pidl"
			--ws-parser
			--outputdir ../..
			${INCLUDE_DIRS}
			--
			${PROTOCOL_NAME}.idl
		COMMAND
			"${CMAKE_COMMAND}" -E touch
			"${CMAKE_CURRENT_BINARY_DIR}/packet-dcerpc-${PROTOCOL_NAME}-stamp"
		WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/${PROTOCOL_NAME}"
		DEPENDS
			"${CMAKE_SOURCE_DIR}/tools/pidl/pidl"
			"${CMAKE_SOURCE_DIR}/tools/pidl/lib/Parse/Pidl/Wireshark/NDR.pm"
			${PROTOCOL_NAME}/${PROTOCOL_NAME}.idl
			${PROTOCOL_NAME}/${PROTOCOL_NAME}.cnf
			${PIDL_DISSECTOR_${PROTOCOL_NAME}_EXTRA_DEPS}
		VERBATIM
		COMMAND_EXPAND_LISTS
	)
	add_custom_target(generate_dissector-dcerpc-${PROTOCOL_NAME}
		DEPENDS packet-dcerpc-${PROTOCOL_NAME}-stamp
	)
	set_target_properties(generate_dissector-dcerpc-${PROTOCOL_NAME}
		PROPERTIES FOLDER "Generated Dissectors/PIDL"
	)
	list(APPEND PIDL_DISSECTOR_TARGETS
		generate_dissector-dcerpc-${PROTOCOL_NAME}
	)
endforeach()

add_custom_target(pidl-dissectors ALL DEPENDS ${PIDL_DISSECTOR_TARGETS})
set_target_properties(pidl-dissectors
	PROPERTIES FOLDER "Generated Dissectors/PIDL"
)

#
# Editor modelines  -  https://www.wireshark.org/tools/modelines.html
#
# Local variables:
# c-basic-offset: 4
# tab-width: 4
# indent-tabs-mode: t
# End:
#
# vi: set shiftwidth=4 tabstop=4 noexpandtab:
# :indentSize=4:tabSize=4:noTabs=false:
#