blob: bb0aee6bb7cf50cf6ba17516f2625562644edc3c [file] [log] [blame]
Jeff Thompson5cae5e52013-07-10 19:41:20 -07001/**
2 * @author: Jeff Thompson
3 * See COPYING for copyright and distribution information.
4 */
5
6#ifndef NDN_KEY_H
Jeff Thompson2d27e2f2013-08-09 12:55:00 -07007#define NDN_KEY_H
Jeff Thompson5cae5e52013-07-10 19:41:20 -07008
Jeff Thompson2d27e2f2013-08-09 12:55:00 -07009#ifdef __cplusplus
Jeff Thompson5cae5e52013-07-10 19:41:20 -070010extern "C" {
11#endif
12
13typedef enum {
14 ndn_KeyLocatorType_KEY = 1,
15 ndn_KeyLocatorType_CERTIFICATE = 2,
16 ndn_KeyLocatorType_KEYNAME = 3
17} ndn_KeyLocatorType;
18
19struct ndn_KeyLocator {
Jeff Thompsonfdc8dc92013-07-11 11:00:44 -070020 ndn_KeyLocatorType type; /**< -1 for none */
Jeff Thompson63d02692013-08-16 12:09:07 -070021 unsigned char *keyData; /**< if type is ndn_KeyLocatorType_KEY, pointer to the pre-allocated buffer for the key value.
22 if type is ndn_KeyLocatorType_CERTIFICATE, pointer to the pre-allocated buffer for the cetrificate value. */
23 unsigned int keyDataLength;
Jeff Thompson5cae5e52013-07-10 19:41:20 -070024 // TODO: Implement keyName.
25};
26
27static inline void ndn_KeyLocator_init(struct ndn_KeyLocator *self) {
28 self->type = (ndn_KeyLocatorType)-1;
Jeff Thompson63d02692013-08-16 12:09:07 -070029 self->keyData = 0;
30 self->keyDataLength = 0;
Jeff Thompson5cae5e52013-07-10 19:41:20 -070031 // TODO: Implement keyName.
32}
33
Jeff Thompson2d27e2f2013-08-09 12:55:00 -070034#ifdef __cplusplus
Jeff Thompson5cae5e52013-07-10 19:41:20 -070035}
36#endif
37
38#endif