summaryrefslogtreecommitdiff
path: root/src/dzl_dockercomm.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/dzl_dockercomm.h')
-rw-r--r--src/dzl_dockercomm.h109
1 files changed, 109 insertions, 0 deletions
diff --git a/src/dzl_dockercomm.h b/src/dzl_dockercomm.h
new file mode 100644
index 0000000..f6394e0
--- /dev/null
+++ b/src/dzl_dockercomm.h
@@ -0,0 +1,109 @@
+/**
+ * @file dzl_dockercomm.h
+ * @brief Connection to Docker engine with connection tool
+
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * This software is the confidential and proprietary information
+ * of Samsung Electronics, Inc. ("Confidential Information"). You
+ * shall not disclose such Confidential Information and shall use
+ * it only in accordance with the terms of the license agreement
+ * you entered into with Samsung.
+ */
+
+#ifndef __DOCKERCOMM_H__
+#define __DOCKERCOMM_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <curl/curl.h>
+#define DOCKER_SOCKET "/var/run/docker.sock"
+
+/**
+ * @struct buffer
+ * @brief This struct contains buffer information
+ *
+ * The buffer struct encapsulate the data and size in the one data
+ *
+ */
+ struct buffer {
+ char *data;
+ size_t size;
+ };
+
+/**
+ * @struct docker
+ * @brief This struct contains buffer and curl information
+ *
+ * The docker struct encapsulate *curl and *buffer in the one data
+ *
+ */
+ struct docker {
+ CURL *curl;
+ struct buffer *buffer;
+ };
+
+ typedef struct docker DOCKER;
+
+/**
+ * @fn DOCKER *dockercomm_docker_init(void)
+ * @brief This function to init for docker structure and curl
+ * @return DOCKER* DOCKER structure
+ */
+ DOCKER *dockercomm_docker_init(void);
+/**
+ * @fn int dockercomm_docker_destroy(DOCKER *docker_client)
+ * @brief This function to destroy for docker structure and clean up curl
+ * @return int result of function
+ */
+ int dockercomm_docker_destroy(DOCKER * docker_client);
+/**
+ * @fn char *dockercomm_docker_buffer(DOCKER *docker_client)
+ * @brief This function to return buffer from DOCKER structure
+ * @brief This function to return buffer from DOCKER structure
+ * @param *docker_client [in] allocated DOCKER struture
+ * @return char* return buffer from DOCKER structure
+ */
+ char *dockercomm_docker_buffer(DOCKER * docker_client);
+/**
+ * @fn CURLcode dockercomm_docker_post(DOCKER *client, char *url, char *data, int datalen, char *contentType)
+ * @brief This function to request POST with body data
+ * @param *docker_client [in] allocated DOCKER struture
+ * @param *url [in] request url
+ * @param *data [in] request body
+ * @param datalen [in] size of request body
+ * @param *contentType [in] request header content type
+ * @return CURLcode return curl request
+ */
+ CURLcode dockercomm_docker_post(DOCKER * client, char *url, char *data, int datalen, char *contentType);
+/**
+ * @fn CURLcode dockercomm_docker_get(DOCKER *docker_client, char *url)
+ * @brief This function to request Get
+ * @param *docker_client [in] allocated DOCKER struture
+ * @param *url [in] request url
+ * @return CURLcode return curl request
+ */
+ CURLcode dockercomm_docker_get(DOCKER * docker_client, char *url);
+/**
+ * @fn CURLcode dockercomm_docker_get_chunked_data(DOCKER *client, char *url, docker_event_cb callback)
+ * @brief This function to request Get chunked data
+ * @param *docker_client [in] allocated DOCKER struture
+ * @param *url [in] request url
+ * @param callback [inout] response chunked data
+ * @return CURLcode return curl request
+ */
+ CURLcode dockercomm_docker_get_chunked_data(DOCKER * client, char *url, docker_event_cb callback);
+/**
+ * @fn CURLcode dockercomm_docker_post_with_only_parameter(DOCKER *docker_client, char *url, char *parameter)
+ * @brief This function to request POST with body data
+ * @param *docker_client [in] allocated DOCKER struture
+ * @param *url [in] request url
+ * @param *parameter [in] request parameter in uri
+ * @return CURLcode return curl request
+ */
+ CURLcode dockercomm_docker_post_with_only_parameter(DOCKER * client, char *url, char *parameter);
+#ifdef __cplusplus
+}
+#endif
+#endif /* __DOCKERCOMM_H__ */