coap_hashkey.h
Go to the documentation of this file.
/*
* coap_hashkey.h -- definition of hash key type and helper functions
*
* Copyright (C) 2010-2011 Olaf Bergmann <bergmann@tzi.org>
*
* This file is part of the CoAP library libcoap. Please see README for terms
* of use.
*/
#ifndef COAP_HASHKEY_H_
#define COAP_HASHKEY_H_
#include "libcoap.h"
#include "uthash.h"
#include "str.h"
typedef unsigned char coap_key_t[4];
#ifndef coap_hash
void coap_hash_impl(const unsigned char *s, unsigned int len, coap_key_t h);
#define coap_hash(String,Length,Result) \
coap_hash_impl((String),(Length),(Result))
/* This is used to control the pre-set hash-keys for resources. */
#define COAP_DEFAULT_HASH
#else
#undef COAP_DEFAULT_HASH
#endif /* coap_hash */
#define coap_str_hash(Str,H) { \
assert(Str); \
memset((H), 0, sizeof(coap_key_t)); \
coap_hash((Str)->s, (Str)->length, (H)); \
}
#endif /* COAP_HASHKEY_H_ */
coap_key_t
unsigned char coap_key_t[4]
Definition: coap_hashkey.h:22
coap_hash_impl
void coap_hash_impl(const unsigned char *s, unsigned int len, coap_key_t h)
Calculates a fast hash over the given string s of length len and stores the result into h.
Definition: coap_hashkey.c:12
libcoap.h
str.h
uthash.h