blob: 6b8583039c4c97994531cb0b7c1a0158ef00be7e [file] [log] [blame]
Alex Perryb3b50792020-01-18 16:13:45 -08001load("//aos/seasocks:gen_embedded.bzl", "gen_embedded")
2load("@com_github_google_flatbuffers//:build_defs.bzl", "flatbuffer_cc_library", "flatbuffer_ts_library")
Austin Schuhe84c3ed2019-12-14 15:29:48 -08003load("//aos:config.bzl", "aos_config")
4
Brian Silverman7a7c24d2018-09-01 17:49:09 -07005package(default_visibility = ["//visibility:public"])
Brian Silverman100534c2015-09-07 15:51:23 -04006
Austin Schuhe84c3ed2019-12-14 15:29:48 -08007flatbuffer_cc_library(
8 name = "connect_fbs",
9 srcs = ["connect.fbs"],
10 gen_reflections = 1,
11 includes = [
12 "//aos:configuration_fbs_includes",
13 ],
14)
15
Alex Perryd5e13572020-02-22 15:15:08 -080016flatbuffer_ts_library(
17 name = "connect_ts_fbs",
18 srcs = ["connect.fbs"],
19 includes = [
20 "//aos:configuration_fbs_includes",
21 ],
22)
23
Austin Schuhe84c3ed2019-12-14 15:29:48 -080024flatbuffer_cc_library(
Austin Schuh7bc59052020-02-16 23:48:33 -080025 name = "timestamp_fbs",
26 srcs = ["timestamp.fbs"],
27 gen_reflections = 1,
28 includes = [
29 "//aos:configuration_fbs_includes",
30 ],
31)
32
33flatbuffer_cc_library(
Austin Schuhe84c3ed2019-12-14 15:29:48 -080034 name = "message_bridge_client_fbs",
35 srcs = ["message_bridge_client.fbs"],
36 gen_reflections = 1,
37 includes = [
38 ":message_bridge_server_fbs_includes",
39 "//aos:configuration_fbs_includes",
40 ],
41)
42
43flatbuffer_cc_library(
44 name = "message_bridge_server_fbs",
45 srcs = ["message_bridge_server.fbs"],
46 gen_reflections = 1,
47 includes = [
48 "//aos:configuration_fbs_includes",
49 ],
50)
51
Brian Silverman100534c2015-09-07 15:51:23 -040052cc_library(
Brian Silverman7a7c24d2018-09-01 17:49:09 -070053 name = "team_number",
54 srcs = [
55 "team_number.cc",
56 ],
57 hdrs = [
58 "team_number.h",
59 ],
Brian Silverman7a7c24d2018-09-01 17:49:09 -070060 deps = [
John Park33858a32018-09-28 23:05:48 -070061 "//aos/util:string_to_num",
Brian Silverman3dfbfb12020-02-17 20:35:18 -080062 "@com_github_google_glog//:glog",
Brian Silverman7a7c24d2018-09-01 17:49:09 -070063 ],
Brian Silverman100534c2015-09-07 15:51:23 -040064)
65
Austin Schuhdf5591e2015-12-19 22:36:50 -080066cc_test(
Brian Silverman7a7c24d2018-09-01 17:49:09 -070067 name = "team_number_test",
68 srcs = [
69 "team_number_test.cc",
70 ],
71 deps = [
72 ":team_number",
Jim Ostrowski8565b402020-02-29 20:26:53 -080073 "//aos:configuration",
Brian Silverman7a7c24d2018-09-01 17:49:09 -070074 "//aos/testing:googletest",
75 ],
Austin Schuhdf5591e2015-12-19 22:36:50 -080076)
Austin Schuhe84c3ed2019-12-14 15:29:48 -080077
78cc_library(
79 name = "sctp_lib",
80 srcs = [
81 "sctp_lib.cc",
82 ],
83 hdrs = [
84 "sctp_lib.h",
85 ],
86 copts = [
87 # The casts required to read datastructures from sockets trip -Wcast-align.
88 "-Wno-cast-align",
89 ],
90 deps = [
91 "//aos:unique_malloc_ptr",
Austin Schuh2fe4b712020-03-15 14:21:45 -070092 "//aos/util:file",
Austin Schuhe84c3ed2019-12-14 15:29:48 -080093 "//third_party/lksctp-tools:sctp",
94 "@com_github_google_glog//:glog",
95 ],
96)
97
98cc_library(
99 name = "sctp_server",
100 srcs = [
101 "sctp_server.cc",
102 ],
103 hdrs = [
104 "sctp_server.h",
105 ],
106 copts = [
107 "-Wno-cast-align",
108 ],
109 deps = [
110 ":sctp_lib",
111 "//third_party/lksctp-tools:sctp",
112 ],
113)
114
115cc_library(
116 name = "message_bridge_protocol",
Austin Schuh7bc59052020-02-16 23:48:33 -0800117 srcs = [
118 "message_bridge_protocol.cc",
119 ],
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800120 hdrs = [
121 "message_bridge_protocol.h",
122 ],
Austin Schuh7bc59052020-02-16 23:48:33 -0800123 deps = [
124 ":connect_fbs",
125 "//aos:configuration",
126 "//aos:flatbuffer_merge",
127 "//aos:flatbuffers",
128 "@com_github_google_flatbuffers//:flatbuffers",
129 ],
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800130)
131
132cc_library(
133 name = "message_bridge_server_lib",
134 srcs = [
135 "message_bridge_server_lib.cc",
136 ],
137 hdrs = [
138 "message_bridge_server_lib.h",
139 ],
140 copts = [
141 "-Wno-cast-align",
142 ],
143 deps = [
144 ":connect_fbs",
Austin Schuh7bc59052020-02-16 23:48:33 -0800145 ":message_bridge_client_fbs",
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800146 ":message_bridge_protocol",
147 ":message_bridge_server_fbs",
148 ":sctp_lib",
149 ":sctp_server",
Austin Schuh7bc59052020-02-16 23:48:33 -0800150 ":timestamp_fbs",
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800151 "//aos:unique_malloc_ptr",
152 "//aos/events:shm_event_loop",
153 "//aos/events/logging:logger",
154 "//third_party/lksctp-tools:sctp",
155 ],
156)
157
158cc_binary(
159 name = "message_bridge_server",
160 srcs = [
161 "message_bridge_server.cc",
162 ],
163 deps = [
164 ":message_bridge_server_lib",
165 "//aos:init",
166 "//aos:json_to_flatbuffer",
167 "//aos/events:shm_event_loop",
168 ],
169)
170
171cc_library(
172 name = "sctp_client",
173 srcs = [
174 "sctp_client.cc",
175 ],
176 hdrs = [
177 "sctp_client.h",
178 ],
179 copts = [
180 "-Wno-cast-align",
181 ],
182 deps = [
183 ":sctp_lib",
184 "//third_party/lksctp-tools:sctp",
185 ],
186)
187
188cc_library(
189 name = "message_bridge_client_lib",
190 srcs = [
191 "message_bridge_client_lib.cc",
192 ],
193 hdrs = [
194 "message_bridge_client_lib.h",
195 ],
196 copts = [
197 "-Wno-cast-align",
198 ],
199 deps = [
200 ":connect_fbs",
201 ":message_bridge_client_fbs",
202 ":message_bridge_protocol",
203 ":message_bridge_server_fbs",
204 ":sctp_client",
Austin Schuh7bc59052020-02-16 23:48:33 -0800205 ":timestamp_fbs",
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800206 "//aos/events:shm_event_loop",
207 "//aos/events/logging:logger",
208 ],
209)
210
211cc_binary(
212 name = "message_bridge_client",
213 srcs = [
214 "message_bridge_client.cc",
215 ],
216 copts = [
217 "-Wno-cast-align",
218 ],
219 deps = [
220 ":message_bridge_client_lib",
221 "//aos:init",
222 "//aos:json_to_flatbuffer",
223 "//aos/events:shm_event_loop",
224 ],
225)
226
227aos_config(
228 name = "message_bridge_test_common_config",
229 src = "message_bridge_test_common.json",
230 flatbuffers = [
231 "//aos/events:ping_fbs",
232 "//aos/events:pong_fbs",
233 "//aos/network:message_bridge_client_fbs",
234 "//aos/network:message_bridge_server_fbs",
Austin Schuh7bc59052020-02-16 23:48:33 -0800235 "//aos/network:timestamp_fbs",
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800236 ],
237 deps = ["//aos/events:config"],
238)
239
240aos_config(
241 name = "message_bridge_test_server_config",
242 src = "message_bridge_test_server.json",
243 deps = [":message_bridge_test_common_config"],
244)
245
246aos_config(
247 name = "message_bridge_test_client_config",
248 src = "message_bridge_test_client.json",
249 deps = [":message_bridge_test_common_config"],
250)
251
252cc_test(
253 name = "message_bridge_test",
254 srcs = [
255 "message_bridge_test.cc",
256 ],
257 data = [
258 ":message_bridge_test_client_config.json",
259 ":message_bridge_test_server_config.json",
260 ],
261 deps = [
262 ":message_bridge_client_lib",
263 ":message_bridge_server_lib",
264 "//aos:json_to_flatbuffer",
265 "//aos/events:ping_fbs",
266 "//aos/events:pong_fbs",
267 "//aos/events:shm_event_loop",
268 "//aos/testing:googletest",
269 ],
270)
Alex Perryb3b50792020-01-18 16:13:45 -0800271
272flatbuffer_cc_library(
273 name = "web_proxy_fbs",
274 srcs = ["web_proxy.fbs"],
Brian Silverman3dfbfb12020-02-17 20:35:18 -0800275 gen_reflections = True,
Alex Perry5f474f22020-02-01 12:14:24 -0800276 includes = [
277 ":connect_fbs_includes",
278 "//aos:configuration_fbs_includes",
279 ],
Alex Perryb3b50792020-01-18 16:13:45 -0800280)
281
282flatbuffer_ts_library(
283 name = "web_proxy_ts_fbs",
284 srcs = ["web_proxy.fbs"],
Alex Perry5f474f22020-02-01 12:14:24 -0800285 includes = [
286 ":connect_fbs_includes",
287 "//aos:configuration_fbs_includes",
288 ],
289)
290
291cc_library(
292 name = "web_proxy_utils",
Alex Perry5f474f22020-02-01 12:14:24 -0800293 srcs = ["web_proxy_utils.cc"],
Brian Silverman3dfbfb12020-02-17 20:35:18 -0800294 hdrs = ["web_proxy_utils.h"],
Alex Perry5f474f22020-02-01 12:14:24 -0800295 deps = [
296 ":connect_fbs",
297 ":web_proxy_fbs",
298 "//aos:configuration_fbs",
299 "//aos/events:event_loop",
300 "@com_github_google_flatbuffers//:flatbuffers",
301 ],
Alex Perryb3b50792020-01-18 16:13:45 -0800302)
303
304cc_library(
305 name = "web_proxy",
Alex Perryb3b50792020-01-18 16:13:45 -0800306 srcs = ["web_proxy.cc"],
Austin Schuh8bd96322020-02-13 21:18:22 -0800307 hdrs = ["web_proxy.h"],
Alex Perryb3b50792020-01-18 16:13:45 -0800308 copts = [
309 "-DWEBRTC_POSIX",
310 "-Wno-unused-parameter",
311 ],
312 deps = [
Alex Perry5f474f22020-02-01 12:14:24 -0800313 ":connect_fbs",
Alex Perryb3b50792020-01-18 16:13:45 -0800314 ":web_proxy_fbs",
Alex Perry5f474f22020-02-01 12:14:24 -0800315 ":web_proxy_utils",
316 "//aos/events:shm_event_loop",
Alex Perryb3b50792020-01-18 16:13:45 -0800317 "//aos/seasocks:seasocks_logger",
Alex Perryb3b50792020-01-18 16:13:45 -0800318 "//third_party:webrtc",
Austin Schuh8bd96322020-02-13 21:18:22 -0800319 "//third_party/seasocks",
Alex Perryb3b50792020-01-18 16:13:45 -0800320 "@com_github_google_glog//:glog",
321 ],
322)
323
324gen_embedded(
325 name = "gen_embedded",
326 srcs = glob(
327 include = ["www_defaults/**/*"],
328 exclude = ["www/**/*"],
329 ),
330)
331
332cc_binary(
333 name = "web_proxy_main",
334 srcs = ["web_proxy_main.cc"],
Alex Perryb3b50792020-01-18 16:13:45 -0800335 copts = [
336 "-DWEBRTC_POSIX",
337 "-Wno-unused-parameter",
338 ],
339 data = [
Alex Perry5f474f22020-02-01 12:14:24 -0800340 "//aos/events:pingpong_config.json",
Brian Silverman3dfbfb12020-02-17 20:35:18 -0800341 "//aos/network/www:files",
342 "//aos/network/www:flatbuffers",
343 "//aos/network/www:main_bundle",
344 "@com_github_google_flatbuffers//:flatjs",
345 ],
346 deps = [
347 ":gen_embedded",
348 ":web_proxy",
349 "//aos:init",
350 "//aos/events:shm_event_loop",
351 "//aos/seasocks:seasocks_logger",
352 "//third_party/seasocks",
353 "@com_github_google_flatbuffers//:flatbuffers",
Alex Perryb3b50792020-01-18 16:13:45 -0800354 ],
355)
Austin Schuh8bd96322020-02-13 21:18:22 -0800356
357cc_library(
358 name = "timestamp_filter",
359 hdrs = ["timestamp_filter.h"],
360 deps = [
361 "//aos/time",
362 ],
363)
364
365cc_test(
366 name = "timestamp_filter_test",
367 srcs = [
368 "timestamp_filter_test.cc",
369 ],
370 deps = [
371 ":timestamp_filter",
372 "//aos/testing:googletest",
373 ],
374)