+/*************************************************************************//**
+ *
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ *
+ * Unless otherwise specified, all software contained herein is
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ****************************************************************************/
+
/**************************************************************************//**
* @file
* Source module isolating the ECOMP Vendor Event Listener (EVEL) API.
* * The API's encoding into JSON.
* * The API's transport over HTTP/HTTPS.
*
- * License
- * -------
- *
- * Copyright(c) <2016>, AT&T Intellectual Property. All other rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. 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.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement: This product includes
- * software developed by the AT&T.
- * 4. Neither the name of AT&T nor the names of its contributors may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY AT&T INTELLECTUAL PROPERTY ''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 AT&T INTELLECTUAL PROPERTY 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.
- *****************************************************************************/
+ ****************************************************************************/
#include <string.h>
#include <assert.h>
* @param path The optional path (may be NULL).
* @param topic The optional topic part of the URL (may be NULL).
* @param secure Whether to use HTTPS (0=HTTP, 1=HTTPS)
+ * @param cert_file_path Path to client certificate file
+ * @param key_file_path Path to client key file
+ * @param ca_info Path to CA cert file
+ * @param ca_file_path Path to CA cert files
+ * @param verify_peer SSL verification of peer 0 or 1
+ * @param verify_host SSL verification of host 0 or 1
* @param username Username for Basic Authentication of requests.
* @param password Password for Basic Authentication of requests.
+ * @param source_ip The ip of node we represent (NULL for default ip).
* @param source_type The kind of node we represent.
* @param role The role this node undertakes.
* @param verbosity 0 for normal operation, positive values for chattier
const char * const path,
const char * const topic,
int secure,
+ const char * const cert_file_path,
+ const char * const key_file_path,
+ const char * const ca_info,
+ const char * const ca_file_path,
+ long verify_peer,
+ long verify_host,
const char * const username,
const char * const password,
+ const char * const source_ip,
EVEL_SOURCE_TYPES source_type,
const char * const role,
int verbosity
}
EVEL_INFO("API transport is: %s", secure ? "HTTPS" : "HTTP");
+ if( secure ) {
+ assert( verify_peer >= 0 );
+ assert( verify_host >= 0 );
+ if (cert_file_path != NULL)
+ {
+ EVEL_INFO("Client cert is: %s", cert_file_path);
+ }
+ else
+ {
+ EVEL_INFO("No Client cert");
+ }
+ if (key_file_path != NULL)
+ {
+ EVEL_INFO("Key file is: %s", key_file_path);
+ }
+ else
+ {
+ EVEL_INFO("No Key file");
+ }
+ if (ca_file_path != NULL)
+ {
+ EVEL_INFO("Client CA certs path is: %s", ca_file_path);
+ }
+ else
+ {
+ EVEL_INFO("No CA certs path");
+ }
+ if (ca_info != NULL)
+ {
+ EVEL_INFO("Client CA cert file is: %s", ca_info);
+ }
+ else
+ {
+ EVEL_INFO("No CA cert file");
+ }
+ }
EVEL_INFO("Event Source Type is: %d", source_type);
EVEL_INFO("Functional Role is: %s", role);
EVEL_INFO("Log verbosity is: %d", verbosity);
/***************************************************************************/
rc = event_handler_initialize(event_api_url,
throt_api_url,
+ source_ip,
+ secure,
+ cert_file_path,
+ key_file_path,
+ ca_info,
+ ca_file_path,
+ verify_peer,
+ verify_host,
username,
password,
verbosity);
free(evt_ptr);
break;
+ case EVEL_DOMAIN_THRESHOLD_CROSS:
+ EVEL_DEBUG("Event is a Threshold crossing at %lp", evt_ptr);
+ evel_free_threshold_cross((EVENT_THRESHOLD_CROSS *)evt_ptr);
+ memset(evt_ptr, 0, sizeof(EVENT_THRESHOLD_CROSS));
+ free(evt_ptr);
+ break;
+
+ case EVEL_DOMAIN_BATCH:
+ EVEL_DEBUG("Event is a Batch at %lp", evt_ptr);
+ evel_free_batch((EVENT_HEADER *)evt_ptr);
+ memset(evt_ptr, 0, sizeof(EVENT_HEADER));
+ free(evt_ptr);
+ break;
+
default:
EVEL_ERROR("Unexpected event domain (%d)", evt_ptr->event_domain);
assert(0);