Soletta™ Framework
Framework for making IoT devices

Full online documentation | C API Index
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
sol-message-digest.h
Go to the documentation of this file.
1 /*
2  * This file is part of the Soletta (TM) Project
3  *
4  * Copyright (C) 2015 Intel Corporation. All rights reserved.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */
18 
19 #pragma once
20 
21 #include <stdbool.h>
22 #include <stdint.h>
23 #include <sol-common-buildopts.h>
24 #include <sol-types.h>
25 #include <sol-str-slice.h>
26 
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30 
86 struct sol_message_digest;
88 
95 typedef struct sol_message_digest_config {
96 #ifndef SOL_NO_API_VERSION
97 #define SOL_MESSAGE_DIGEST_CONFIG_API_VERSION (1)
98 
102  uint16_t api_version;
103 #endif
104 
116  const char *algorithm;
143  void (*on_digest_ready)(void *data, struct sol_message_digest *handle, struct sol_blob *output);
165  void (*on_feed_done)(void *data, struct sol_message_digest *handle, struct sol_blob *input, int status);
169  const void *data;
170 
180  size_t feed_size;
182 
196 
203 void sol_message_digest_del(struct sol_message_digest *handle);
204 
243 int sol_message_digest_feed(struct sol_message_digest *handle, struct sol_blob *input, bool is_last);
244 
249 #ifdef __cplusplus
250 }
251 #endif
252 
struct sol_message_digest sol_message_digest
A handle for a message digest.
Definition: sol-message-digest.h:87
const void * data
The context data to give to all callbacks.
Definition: sol-message-digest.h:169
These routines are used for Soletta types' manipulation.
struct sol_message_digest_config sol_message_digest_config
The message digest configuration to use when creating a new handle.
const char * algorithm
Algorithm name.
Definition: sol-message-digest.h:116
void(* on_digest_ready)(void *data, struct sol_message_digest *handle, struct sol_blob *output)
The mandatory callback function to report digest is ready.
Definition: sol-message-digest.h:143
struct sol_str_slice key
If provided (length > 0), then is used by the message digest hash function.
Definition: sol-message-digest.h:124
void(* on_feed_done)(void *data, struct sol_message_digest *handle, struct sol_blob *input, int status)
The optional callback function to report digest consumed given data.
Definition: sol-message-digest.h:165
struct sol_message_digest * sol_message_digest_new(const struct sol_message_digest_config *config)
Create a new handle to feed the message to digest.
The message digest configuration to use when creating a new handle.
Definition: sol-message-digest.h:95
String slice type.
Definition: sol-str-slice.h:84
int sol_message_digest_feed(struct sol_message_digest *handle, struct sol_blob *input, bool is_last)
Feed message (data) to be digested (hashed).
uint16_t api_version
api_version must match SOL_MESSAGE_DIGEST_CONFIG_API_VERSION at runtime.
Definition: sol-message-digest.h:102
void sol_message_digest_del(struct sol_message_digest *handle)
Delete a message digest handle.
Data type describing the default blob implementation.
Definition: sol-types.h:468
size_t feed_size
The feed buffer max size.
Definition: sol-message-digest.h:180
These are routines that Soletta provides for its string slice implementation.