From 3454a59e99f9106018876a4039f97301a302ea60 Mon Sep 17 00:00:00 2001 From: jcli Date: Tue, 20 Oct 2015 16:26:28 -0700 Subject: [PATCH] dial spec 1.7 --- .gitignore | 4 + Changelog | 55 ++ LICENSE | 19 + README | 78 +++ build/Version.h | 38 ++ build/dial_build.sh | 66 +++ client/DialClientInput.cpp | 133 +++++ client/DialClientInput.h | 89 ++++ client/DialConformance.cpp | 587 +++++++++++++++++++++ client/DialConformance.h | 227 ++++++++ client/DialDiscovery.cpp | 344 ++++++++++++ client/DialDiscovery.h | 94 ++++ client/DialServer.cpp | 249 +++++++++ client/DialServer.h | 181 +++++++ client/build.sh | 5 + client/dialclient_input.txt | 80 +++ client/main.cpp | 298 +++++++++++ client/makefile | 14 + makefile | 8 + server/build.sh | 2 + server/dial_data.c | 87 ++++ server/dial_data.h | 63 +++ server/dial_options.h | 86 +++ server/dial_server.c | 627 ++++++++++++++++++++++ server/dial_server.h | 158 ++++++ server/main.c | 470 +++++++++++++++++ server/makefile | 25 + server/mongoose.c | 956 ++++++++++++++++++++++++++++++++++ server/mongoose.h | 160 ++++++ server/quick_ssdp.c | 242 +++++++++ server/tests/makefile | 18 + server/tests/run_tests.c | 42 ++ server/tests/test.h | 53 ++ server/tests/test_cors.html | 57 ++ server/tests/test_cors.sh | 71 +++ server/tests/test_dial_data.c | 66 +++ server/tests/test_dial_data.h | 31 ++ server/tests/test_url_lib.c | 113 ++++ server/tests/test_url_lib.h | 34 ++ server/url_lib.c | 183 +++++++ server/url_lib.h | 61 +++ 41 files changed, 6174 insertions(+) create mode 100644 .gitignore create mode 100644 Changelog create mode 100644 LICENSE create mode 100644 README create mode 100644 build/Version.h create mode 100755 build/dial_build.sh create mode 100644 client/DialClientInput.cpp create mode 100644 client/DialClientInput.h create mode 100644 client/DialConformance.cpp create mode 100644 client/DialConformance.h create mode 100644 client/DialDiscovery.cpp create mode 100644 client/DialDiscovery.h create mode 100644 client/DialServer.cpp create mode 100644 client/DialServer.h create mode 100755 client/build.sh create mode 100644 client/dialclient_input.txt create mode 100644 client/main.cpp create mode 100644 client/makefile create mode 100644 makefile create mode 100755 server/build.sh create mode 100644 server/dial_data.c create mode 100644 server/dial_data.h create mode 100644 server/dial_options.h create mode 100644 server/dial_server.c create mode 100644 server/dial_server.h create mode 100644 server/main.c create mode 100644 server/makefile create mode 100644 server/mongoose.c create mode 100644 server/mongoose.h create mode 100644 server/quick_ssdp.c create mode 100644 server/tests/makefile create mode 100644 server/tests/run_tests.c create mode 100644 server/tests/test.h create mode 100644 server/tests/test_cors.html create mode 100755 server/tests/test_cors.sh create mode 100644 server/tests/test_dial_data.c create mode 100644 server/tests/test_dial_data.h create mode 100644 server/tests/test_url_lib.c create mode 100644 server/tests/test_url_lib.h create mode 100644 server/url_lib.c create mode 100644 server/url_lib.h diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..cb029e8 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +*.o +client/dialclient +server/dialserver +server/tests/run_tests diff --git a/Changelog b/Changelog new file mode 100644 index 0000000..0906af8 --- /dev/null +++ b/Changelog @@ -0,0 +1,55 @@ +--------------------------------------------------------------------- +Version 1.0.5 (06edbce) +--------------------------------------------------------------------- +Server changes: + - Update to DIAL specificiation 1.7.2 + - CORE compliance security patch + - Added CORS compliance test scripts + +--------------------------------------------------------------------- +Version 1.0.4 (1673785) +--------------------------------------------------------------------- +Server changes: + - Update to DIAL specificiation 1.7 + - Catch SIGTERM so that we don't self terminate. + +--------------------------------------------------------------------- +Version 1.0.2 (1673785) +--------------------------------------------------------------------- +Server changes: + - Fix an application state bug when the application is launched + without using DIAL. + - Remove unnecessary functionality from Mongoose. + - Use constant values for DIAL port. + - Propery reap child processes. + +Client (test tool) changes: + - None + +--------------------------------------------------------------------- +Version 1.0.1 (1601607) +--------------------------------------------------------------------- +General Changes: + - Simplified directory structure. + - Version.txt changed to Version.h. + - moved main Makefile into src dir. + +Server changes: + - Server configuration options moved into dial_options.h. + - Added logic to walk/proc to see if the named app (eg Netflix) + is running before attempting to start/kill the app. + - Improved payload handling: + - Explicitly define payload size. + - Added logic to check validity of payload, and send HTTP 400 + "bad request" responses to requests with improper payloads. + - Added URL encoding for payloads. + - Added logic to compare launch payload on subsequent launch + requests. + +Client (test tool) changes: + - small change to printed format of server names. + +--------------------------------------------------------------------- +Version 1.0 (1416215) +--------------------------------------------------------------------- +Initial release. diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..0ab73c0 --- /dev/null +++ b/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2015 Netflix, Inc. +All rights reserved. +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: +· Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +· Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. +THIS SOFTWARE IS PROVIDED BY NETFLIX, INC. AND CONTRIBUTORS "AS IS" AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL NETFLIX OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/README b/README new file mode 100644 index 0000000..befd198 --- /dev/null +++ b/README @@ -0,0 +1,78 @@ +-------------------------------------------------------------------------------- +Building the DIAL server +-------------------------------------------------------------------------------- +1) Define the TARGET environment variable to point to the CC compiler prefix + for your target platform. + + +2) Run make, passing in your TARGET value. + + For example: + TARGET=/usr/local/i686-DIAL-EXAMPLE/bin/i686-DIAL-EXAMPLE make + +-------------------------------------------------------------------------------- +Running the DIAL server +-------------------------------------------------------------------------------- +The DIAL server should be started as a service, after the platform's networking +has been initialized, and it should remain running at all times (a daemon +process in the system). + + +-------------------------------------------------------------------------------- +Building the DIAL client +-------------------------------------------------------------------------------- +The DIAL client is a standalone C++ console application you can use to test +a running DIAL server implementation on your device. Unlike the server, which +is built for, and meant to run on your device, the client is meant to run on +your desktop (development) machine. + +The DIAL client uses CURL to send HTTP REST commands to the DIAL server, so to +build the client, you need to ensure that the CURL dependencies are +defined properly. + +Alternatively, you can build against a different, current version of libcurl. +Adjust the INCLUDES and LDFLAGS definitions to point to your actual libcurl +header and library locations. In most cases, you can omit the TARGET define. + +Note: the -rpath argument passed to LDFLAGS specifies the libcurl location +to the runtime linker. + +-------------------------------------------------------------------------------- +Running the DIAL client in interactive (menu) mode +-------------------------------------------------------------------------------- +1) The DIAL client application must be running in the same subnet as the + DIAL server. + +2) Start the client: ./dialclient (or ./dialclient -m) + The on-screen menu will list all available actions. + +-------------------------------------------------------------------------------- +Running the DIAL client in conformance test (non-interactive) mode +-------------------------------------------------------------------------------- +1) The DIAL client application must be running in the same subnet as the + DIAL server. + +2) Start the client: + ./dialclient -i [input-file] [-o output-file] [-a server-IP-addr] + + In script-driven mode, the client reads in an input-file, executes the + instructions in the input-file, and generates a + report. The default file locations (which can be overridden) are: + ./dialclient_input.txt + ./report.html + +-------------------------------------------------------------------------------- +DIAL client Usage +-------------------------------------------------------------------------------- +When running the DIAL client, you have the following options +usage: dialclient