00001 /* 00002 Copyright 2017 Otavio Rodolfo Piske 00003 00004 Licensed under the Apache License, Version 2.0 (the "License"); 00005 you may not use this file except in compliance with the License. 00006 You may obtain a copy of the License at 00007 00008 http://www.apache.org/licenses/LICENSE-2.0 00009 00010 Unless required by applicable law or agreed to in writing, software 00011 distributed under the License is distributed on an "AS IS" BASIS, 00012 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 See the License for the specific language governing permissions and 00014 limitations under the License. 00015 */ 00016 00017 #ifndef GRU_KEYPAIR_H 00018 #define GRU_KEYPAIR_H 00019 00020 #include <stdint.h> 00021 #include <string.h> 00022 00023 #include "gru_portable.h" 00024 #include "gru_status.h" 00025 #include "gru_variant.h" 00026 00027 #ifdef __cplusplus 00028 extern "C" { 00029 #endif 00030 00034 typedef struct gru_keypair_t_ { 00035 char *key; 00036 gru_variant_t *pair; 00037 } gru_keypair_t; 00038 00044 gru_export gru_keypair_t *gru_keypair_new(gru_status_t *status); 00045 00050 gru_export void gru_keypair_destroy(gru_keypair_t **ptr); 00051 00056 gru_export void gru_keypair_destroy_list_item(void **ptr); 00057 00058 00065 gru_export bool gru_keypair_set_key(gru_keypair_t *kp, const char *key); 00066 00067 00074 gru_export gru_keypair_t *gru_keypair_clone(const gru_keypair_t *kp, gru_status_t *status); 00075 00076 00083 gru_export bool gru_keypair_key_equals(const gru_keypair_t *kp, const char *key); 00084 00085 00092 gru_export gru_keypair_t *gru_keypair_parse(const char *str, gru_status_t *status); 00093 00094 #ifdef __cplusplus 00095 } 00096 #endif 00097 00098 #endif //GRU_KEYPAIR_H