mirror of
https://github.com/google/sandboxed-api.git
synced 2024-03-22 13:11:30 +08:00
Improve comments
This commit is contained in:
parent
05c0a4b004
commit
5be51fabbe
|
@ -19,24 +19,20 @@ project(curl_sandboxed)
|
|||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED True)
|
||||
|
||||
# add folder containing the non-sandboxed custom curl library
|
||||
|
||||
# Add folder containing the non-sandboxed custom curl library
|
||||
add_subdirectory(custom_curl)
|
||||
|
||||
# setup sandboxed api
|
||||
|
||||
# Setup Sandboxed API
|
||||
set(SAPI_ROOT "" CACHE PATH "Path to the Sandboxed API source tree")
|
||||
set(SAPI_ENABLE_EXAMPLES OFF CACHE BOOL "")
|
||||
set(SAPI_ENABLE_TESTS OFF CACHE BOOL "")
|
||||
|
||||
add_subdirectory(
|
||||
"${SAPI_ROOT}"
|
||||
"${CMAKE_BINARY_DIR}/sandboxed-api-build"
|
||||
EXCLUDE_FROM_ALL
|
||||
)
|
||||
|
||||
# generate and include generated sapi header
|
||||
|
||||
# Generate SAPI header
|
||||
add_sapi_library(curl_sapi
|
||||
|
||||
FUNCTIONS curl_easy_cleanup
|
||||
|
@ -71,10 +67,10 @@ add_sapi_library(curl_sapi
|
|||
NAMESPACE ""
|
||||
)
|
||||
|
||||
# Include generated SAPI header
|
||||
target_include_directories(curl_sapi INTERFACE
|
||||
"${PROJECT_BINARY_DIR}"
|
||||
)
|
||||
|
||||
# add examples
|
||||
|
||||
# Add examples
|
||||
add_subdirectory(examples)
|
||||
|
|
|
@ -12,22 +12,21 @@
|
|||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# flags needed to build curl statically
|
||||
|
||||
# Flags needed to build curl statically
|
||||
set(CURL_HIDDEN_SYMBOLS OFF)
|
||||
set(BUILD_SHARED_LIBS OFF)
|
||||
|
||||
add_subdirectory(curl)
|
||||
|
||||
# Wrapper library including curl,
|
||||
# adds the explicit versions of the variadic methods
|
||||
add_library(custom_curl STATIC
|
||||
custom_curl.h
|
||||
custom_curl.cc
|
||||
)
|
||||
|
||||
set_target_properties(custom_curl
|
||||
PROPERTIES LINKER_LANGUAGE C
|
||||
)
|
||||
|
||||
target_link_libraries(custom_curl
|
||||
CURL::libcurl
|
||||
)
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
// wrapper for curl library used to implement variadic functions explicitly
|
||||
// Wrapper for curl library used to implement variadic methods explicitly
|
||||
|
||||
#ifndef CUSTOM_CURL_H
|
||||
#define CUSTOM_CURL_H
|
||||
|
|
|
@ -12,12 +12,10 @@
|
|||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# example 1: GET request, verbose
|
||||
|
||||
# Example 1: GET request, verbose
|
||||
add_executable(example1
|
||||
example1.cc
|
||||
)
|
||||
|
||||
target_link_libraries(example1 PRIVATE
|
||||
curl_sapi
|
||||
sapi::sapi
|
||||
|
|
|
@ -12,22 +12,10 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#include <libgen.h>
|
||||
#include <syscall.h>
|
||||
#include <iostream>
|
||||
|
||||
#include "curl_sapi.sapi.h"
|
||||
|
||||
/*
|
||||
int main() {
|
||||
CURL *curl = curl_easy_init();
|
||||
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1l);
|
||||
curl_easy_setopt(curl, CURLOPT_URL, "http://example.com");
|
||||
curl_easy_perform(curl);
|
||||
curl_easy_cleanup(curl);
|
||||
}
|
||||
*/
|
||||
|
||||
class CurlApiSandboxEx1 : public CurlSandbox {
|
||||
|
||||
std::unique_ptr<sandbox2::Policy> ModifyPolicy(
|
||||
|
@ -44,6 +32,8 @@ class CurlApiSandboxEx1 : public CurlSandbox {
|
|||
|
||||
int main(int argc, char* argv[]) {
|
||||
|
||||
// GET http://example.com
|
||||
|
||||
CurlApiSandboxEx1 sandbox;
|
||||
|
||||
auto status_sandbox_init = sandbox.Init();
|
||||
|
|
Loading…
Reference in New Issue
Block a user