blob: c725ab79d310a135dd1d6eec34c727dbb95354be [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(
Austin Schuhe19b6752020-08-27 23:20:19 -0700133 name = "message_bridge_server_status",
134 srcs = [
135 "message_bridge_server_status.cc",
136 ],
137 hdrs = [
138 "message_bridge_server_status.h",
139 ],
140 deps = [
141 ":message_bridge_client_fbs",
142 ":message_bridge_server_fbs",
143 ":timestamp_fbs",
144 ":timestamp_filter",
145 "//aos:flatbuffer_merge",
146 "//aos:flatbuffers",
147 "//aos/events:event_loop",
148 "//aos/time",
149 ],
150)
151
152cc_library(
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800153 name = "message_bridge_server_lib",
154 srcs = [
155 "message_bridge_server_lib.cc",
156 ],
157 hdrs = [
158 "message_bridge_server_lib.h",
159 ],
160 copts = [
161 "-Wno-cast-align",
162 ],
163 deps = [
164 ":connect_fbs",
Austin Schuh7bc59052020-02-16 23:48:33 -0800165 ":message_bridge_client_fbs",
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800166 ":message_bridge_protocol",
167 ":message_bridge_server_fbs",
Austin Schuhe19b6752020-08-27 23:20:19 -0700168 ":message_bridge_server_status",
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800169 ":sctp_lib",
170 ":sctp_server",
Austin Schuh7bc59052020-02-16 23:48:33 -0800171 ":timestamp_fbs",
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800172 "//aos:unique_malloc_ptr",
173 "//aos/events:shm_event_loop",
174 "//aos/events/logging:logger",
175 "//third_party/lksctp-tools:sctp",
176 ],
177)
178
179cc_binary(
180 name = "message_bridge_server",
181 srcs = [
182 "message_bridge_server.cc",
183 ],
184 deps = [
185 ":message_bridge_server_lib",
186 "//aos:init",
187 "//aos:json_to_flatbuffer",
188 "//aos/events:shm_event_loop",
189 ],
190)
191
192cc_library(
193 name = "sctp_client",
194 srcs = [
195 "sctp_client.cc",
196 ],
197 hdrs = [
198 "sctp_client.h",
199 ],
200 copts = [
201 "-Wno-cast-align",
202 ],
203 deps = [
204 ":sctp_lib",
205 "//third_party/lksctp-tools:sctp",
206 ],
207)
208
209cc_library(
Austin Schuhae2e7bf2020-08-27 23:42:56 -0700210 name = "message_bridge_client_status",
211 srcs = [
212 "message_bridge_client_status.cc",
213 ],
214 hdrs = [
215 "message_bridge_client_status.h",
216 ],
217 deps = [
218 ":message_bridge_client_fbs",
219 ":message_bridge_server_fbs",
220 ":timestamp_filter",
221 "//aos:flatbuffers",
222 "//aos/events:event_loop",
223 "//aos/time",
224 ],
225)
226
227cc_library(
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800228 name = "message_bridge_client_lib",
229 srcs = [
230 "message_bridge_client_lib.cc",
231 ],
232 hdrs = [
233 "message_bridge_client_lib.h",
234 ],
235 copts = [
236 "-Wno-cast-align",
237 ],
238 deps = [
239 ":connect_fbs",
240 ":message_bridge_client_fbs",
Austin Schuhae2e7bf2020-08-27 23:42:56 -0700241 ":message_bridge_client_status",
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800242 ":message_bridge_protocol",
243 ":message_bridge_server_fbs",
244 ":sctp_client",
Austin Schuh7bc59052020-02-16 23:48:33 -0800245 ":timestamp_fbs",
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800246 "//aos/events:shm_event_loop",
247 "//aos/events/logging:logger",
248 ],
249)
250
251cc_binary(
252 name = "message_bridge_client",
253 srcs = [
254 "message_bridge_client.cc",
255 ],
256 copts = [
257 "-Wno-cast-align",
258 ],
259 deps = [
260 ":message_bridge_client_lib",
261 "//aos:init",
262 "//aos:json_to_flatbuffer",
263 "//aos/events:shm_event_loop",
264 ],
265)
266
267aos_config(
268 name = "message_bridge_test_common_config",
269 src = "message_bridge_test_common.json",
270 flatbuffers = [
Austin Schuh2f8fd752020-09-01 22:38:28 -0700271 "//aos/events/logging:logger_fbs",
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800272 "//aos/events:ping_fbs",
273 "//aos/events:pong_fbs",
274 "//aos/network:message_bridge_client_fbs",
275 "//aos/network:message_bridge_server_fbs",
Austin Schuh7bc59052020-02-16 23:48:33 -0800276 "//aos/network:timestamp_fbs",
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800277 ],
278 deps = ["//aos/events:config"],
279)
280
281aos_config(
282 name = "message_bridge_test_server_config",
283 src = "message_bridge_test_server.json",
284 deps = [":message_bridge_test_common_config"],
285)
286
287aos_config(
288 name = "message_bridge_test_client_config",
289 src = "message_bridge_test_client.json",
290 deps = [":message_bridge_test_common_config"],
291)
292
293cc_test(
294 name = "message_bridge_test",
295 srcs = [
296 "message_bridge_test.cc",
297 ],
298 data = [
Austin Schuh14d7d3d2020-09-10 18:14:36 -0700299 ":message_bridge_test_client_config",
300 ":message_bridge_test_server_config",
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800301 ],
Austin Schuh4889b182020-11-18 19:11:56 -0800302 shard_count = 5,
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800303 deps = [
304 ":message_bridge_client_lib",
305 ":message_bridge_server_lib",
Austin Schuh4889b182020-11-18 19:11:56 -0800306 "//aos:event",
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800307 "//aos:json_to_flatbuffer",
308 "//aos/events:ping_fbs",
309 "//aos/events:pong_fbs",
310 "//aos/events:shm_event_loop",
311 "//aos/testing:googletest",
312 ],
313)
Alex Perryb3b50792020-01-18 16:13:45 -0800314
315flatbuffer_cc_library(
316 name = "web_proxy_fbs",
317 srcs = ["web_proxy.fbs"],
Brian Silverman3dfbfb12020-02-17 20:35:18 -0800318 gen_reflections = True,
Alex Perry5f474f22020-02-01 12:14:24 -0800319 includes = [
320 ":connect_fbs_includes",
321 "//aos:configuration_fbs_includes",
322 ],
Alex Perryb3b50792020-01-18 16:13:45 -0800323)
324
325flatbuffer_ts_library(
326 name = "web_proxy_ts_fbs",
327 srcs = ["web_proxy.fbs"],
Alex Perry5f474f22020-02-01 12:14:24 -0800328 includes = [
329 ":connect_fbs_includes",
330 "//aos:configuration_fbs_includes",
331 ],
332)
333
334cc_library(
335 name = "web_proxy_utils",
Alex Perry5f474f22020-02-01 12:14:24 -0800336 srcs = ["web_proxy_utils.cc"],
Brian Silverman3dfbfb12020-02-17 20:35:18 -0800337 hdrs = ["web_proxy_utils.h"],
Alex Perry5f474f22020-02-01 12:14:24 -0800338 deps = [
339 ":connect_fbs",
340 ":web_proxy_fbs",
341 "//aos:configuration_fbs",
342 "//aos/events:event_loop",
343 "@com_github_google_flatbuffers//:flatbuffers",
344 ],
Alex Perryb3b50792020-01-18 16:13:45 -0800345)
346
347cc_library(
348 name = "web_proxy",
Alex Perryb3b50792020-01-18 16:13:45 -0800349 srcs = ["web_proxy.cc"],
Austin Schuh8bd96322020-02-13 21:18:22 -0800350 hdrs = ["web_proxy.h"],
Alex Perryb3b50792020-01-18 16:13:45 -0800351 copts = [
352 "-DWEBRTC_POSIX",
353 "-Wno-unused-parameter",
354 ],
355 deps = [
Alex Perry5f474f22020-02-01 12:14:24 -0800356 ":connect_fbs",
Alex Perryb3b50792020-01-18 16:13:45 -0800357 ":web_proxy_fbs",
Alex Perry5f474f22020-02-01 12:14:24 -0800358 ":web_proxy_utils",
359 "//aos/events:shm_event_loop",
Alex Perryb3b50792020-01-18 16:13:45 -0800360 "//aos/seasocks:seasocks_logger",
Alex Perryb3b50792020-01-18 16:13:45 -0800361 "//third_party:webrtc",
Austin Schuh8bd96322020-02-13 21:18:22 -0800362 "//third_party/seasocks",
Alex Perryb3b50792020-01-18 16:13:45 -0800363 "@com_github_google_glog//:glog",
364 ],
365)
366
367gen_embedded(
368 name = "gen_embedded",
369 srcs = glob(
370 include = ["www_defaults/**/*"],
371 exclude = ["www/**/*"],
372 ),
373)
374
375cc_binary(
376 name = "web_proxy_main",
377 srcs = ["web_proxy_main.cc"],
Alex Perryb3b50792020-01-18 16:13:45 -0800378 copts = [
379 "-DWEBRTC_POSIX",
380 "-Wno-unused-parameter",
381 ],
382 data = [
Brian Silverman3dfbfb12020-02-17 20:35:18 -0800383 "//aos/network/www:files",
Austin Schuhda9d0602019-09-15 17:29:38 -0700384 "//aos/network/www:main_bundle.min.js",
Brian Silverman3dfbfb12020-02-17 20:35:18 -0800385 "@com_github_google_flatbuffers//:flatjs",
386 ],
387 deps = [
388 ":gen_embedded",
389 ":web_proxy",
390 "//aos:init",
391 "//aos/events:shm_event_loop",
392 "//aos/seasocks:seasocks_logger",
393 "//third_party/seasocks",
394 "@com_github_google_flatbuffers//:flatbuffers",
Alex Perryb3b50792020-01-18 16:13:45 -0800395 ],
396)
Austin Schuh8bd96322020-02-13 21:18:22 -0800397
398cc_library(
399 name = "timestamp_filter",
Austin Schuh7ee6f722020-08-24 16:19:36 -0700400 srcs = ["timestamp_filter.cc"],
Austin Schuh8bd96322020-02-13 21:18:22 -0800401 hdrs = ["timestamp_filter.h"],
402 deps = [
Austin Schuh04eccfc2020-08-26 21:08:27 -0700403 "//aos:configuration",
Austin Schuh8bd96322020-02-13 21:18:22 -0800404 "//aos/time",
Austin Schuhe52e23b2020-08-24 21:18:24 -0700405 "//third_party/gmp",
Austin Schuh85357ee2020-08-24 16:41:42 -0700406 "@com_google_absl//absl/strings",
Austin Schuh8bd96322020-02-13 21:18:22 -0800407 ],
408)
409
410cc_test(
411 name = "timestamp_filter_test",
412 srcs = [
413 "timestamp_filter_test.cc",
414 ],
415 deps = [
416 ":timestamp_filter",
Austin Schuh04eccfc2020-08-26 21:08:27 -0700417 "//aos:json_to_flatbuffer",
Austin Schuh8bd96322020-02-13 21:18:22 -0800418 "//aos/testing:googletest",
419 ],
420)