-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #45 from vijs/master
Updated certifierUtil to use xc APIs
- Loading branch information
Showing
9 changed files
with
584 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#ifndef CODE_UTILS_H | ||
#define CODE_UTILS_H | ||
|
||
#define ReturnErrorOnFailure(expr) \ | ||
do \ | ||
{ \ | ||
int __err = (expr); \ | ||
if (__err != 0) \ | ||
{ \ | ||
return __err; \ | ||
} \ | ||
} while (0) | ||
|
||
#define VerifyOrReturnError(expr, code) \ | ||
do \ | ||
{ \ | ||
if (!(expr)) \ | ||
{ \ | ||
return (code); \ | ||
} \ | ||
} while (0) | ||
|
||
#define VerifyOrExit(statement, action) \ | ||
do \ | ||
{ \ | ||
if ((statement) != 1) \ | ||
{ \ | ||
action; \ | ||
goto exit; \ | ||
} \ | ||
} while (0) | ||
|
||
#endif // CODE_UTILS_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#ifndef XPKI_CLIENT_INTERNAL_H | ||
#define XPKI_CLIENT_INTERNAL_H | ||
|
||
#include "certifier/certifier.h" | ||
|
||
extern Certifier * get_certifier_instance(); | ||
|
||
#endif // XPKI_CLIENT_INTERNAL_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/** | ||
* Copyright 2019 Comcast Cable Communications Management, LLC | ||
* | ||
* 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. | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
#define _POSIX_C_SOURCE 2 | ||
|
||
// Includes | ||
#include "certifier/certifier_api_easy.h" | ||
#include "certifier/log.h" | ||
#include "certifier/types.h" | ||
|
||
// Main | ||
int main(int argc, char * argv[]) | ||
{ | ||
int return_code = 0; | ||
CERTIFIER * easy = certifier_api_easy_new(); | ||
|
||
certifier_api_easy_set_cli_args(easy, argc, argv); | ||
certifier_api_easy_set_mode(easy, certifier_api_easy_get_mode(easy)); | ||
return_code = certifier_api_easy_perform(easy); | ||
|
||
const char * result = certifier_api_easy_get_result_json(easy); | ||
|
||
if (result != NULL) | ||
{ | ||
log_info(result); | ||
} | ||
|
||
certifier_api_easy_destroy(easy); | ||
|
||
return return_code != 0; | ||
} |
Oops, something went wrong.