6a5e10492c
This decouples the build and packaging of guest-server, guest-agent from mtce, by splitting guest component into stx-nfv repo. This leaves existing C++ code, scripts, and resource files untouched, so there is no functional change. Code refactoring is beyond the scope of this update. Makefiles were modified to include devel headers directories /usr/include/mtce-common and /usr/include/mtce-daemon. This ensures there is no contamination with other system headers. The cgts-mtce-common package is renamed and split into: - repo stx-metal: mtce-common, mtce-common-dev - repo stx-metal: mtce - repo stx-nfv: mtce-guest - repo stx-ha: updates package dependencies to mtce-pmon for service-mgmt, sm, and sm-api mtce-common: - contains common and daemon shared source utility code mtce-common-dev: - based on mtce-common, contains devel package required to build mtce-guest and mtce - contains common library archives and headers mtce: - contains components: alarm, fsmon, fsync, heartbeat, hostw, hwmon, maintenance, mtclog, pmon, public, rmon mtce-guest: - contains guest component guest-server, guest-agent Story: 2002829 Task: 22748 Change-Id: I9c7a9b846fd69fd566b31aa3f12a043c08f19f1f Signed-off-by: Jim Gauld <james.gauld@windriver.com>
88 lines
2.6 KiB
C++
Executable File
88 lines
2.6 KiB
C++
Executable File
#ifndef __INCLUDE_MTCHTTPUTIL_H__
|
|
#define __INCLUDE_MTCHTTPUTIL_H__
|
|
/*
|
|
* Copyright (c) 2013, 2016 Wind River Systems, Inc.
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*
|
|
*/
|
|
|
|
/**
|
|
* @file
|
|
* Wind River CGTS Platform Controller Maintenance ...
|
|
*
|
|
* libevent HTTP support utilities and control structure support header
|
|
*/
|
|
|
|
#include <iostream> /* for ... string */
|
|
#include <evhttp.h> /* for ... http libevent client */
|
|
|
|
using namespace std;
|
|
|
|
#include "httpUtil.h"
|
|
|
|
|
|
void mtcHttpUtil_init ( void );
|
|
|
|
int mtcHttpUtil_event_init ( libEvent * ptr ,
|
|
string hostname,
|
|
string service,
|
|
string ip,
|
|
int port );
|
|
|
|
/** Maximum number of headers that can be added to an HTTP message. */
|
|
#define MAX_HEADERS (10)
|
|
|
|
/** Add payload to the HTTP message body. */
|
|
int mtcHttpUtil_payload_add ( libEvent & event );
|
|
|
|
/** Add all headers in header table to the HTTP connection message. */
|
|
int mtcHttpUtil_header_add ( libEvent * ptr, http_headers_type * hdrs_ptr );
|
|
|
|
/** Create an HTTP request. */
|
|
int mtcHttpUtil_request_make ( libEvent * ptr, enum evhttp_cmd_type type, string path );
|
|
|
|
/** Open a connection to an HTTP server. */
|
|
int mtcHttpUtil_connect_new ( libEvent & event );
|
|
|
|
/** Get a new HTTP request pointer. */
|
|
int mtcHttpUtil_request_new ( libEvent & event,
|
|
void(*hdlr)(struct evhttp_request *, void *));
|
|
|
|
/** Common REST API Request Utility */
|
|
int mtcHttpUtil_api_request ( libEvent & event );
|
|
|
|
/** Common REST API Request Utility */
|
|
int mtcHttpUtil_request ( libEvent & event , bool block,
|
|
void(*hdlr)(struct evhttp_request *, void *));
|
|
|
|
/** Common REST API Receive Utility for non-blocking requests */
|
|
int mtcHttpUtil_receive ( libEvent & event );
|
|
|
|
/** HTTP response status checker */
|
|
int mtcHttpUtil_status ( libEvent & event );
|
|
|
|
/** Free the libEvent */
|
|
void mtcHttpUtil_free_base ( libEvent & event );
|
|
|
|
/** Free the event lib connection */
|
|
void mtcHttpUtil_free_conn ( libEvent & event );
|
|
|
|
/** TODO: FIXME: Get the payload string length. */
|
|
string mtcHttpUtil_payload_len ( libEvent * ptr );
|
|
|
|
/** Get the length of the json response */
|
|
int mtcHttpUtil_get_length ( libEvent & event );
|
|
|
|
/** Load the json response into the event struct */
|
|
int mtcHttpUtil_get_response ( libEvent & event );
|
|
|
|
/** print event filtered event */
|
|
void mtcHttpUtil_log_event ( libEvent & event );
|
|
|
|
void mtcHttpUtil_event_info ( libEvent & event );
|
|
|
|
const char * getHttpCmdType_str ( evhttp_cmd_type type );
|
|
|
|
#endif /* __INCLUDE_MTCHTTPUTIL_H__ */
|