libcoap
4.1.1
Main Page
Related Pages
Modules
Data Structures
Files
File List
Globals
All
Data Structures
Files
Functions
Variables
Typedefs
Macros
Groups
Pages
hashkey.h
Go to the documentation of this file.
1
/* hashkey.h -- definition of hash key type and helper functions
2
*
3
* Copyright (C) 2010,2011 Olaf Bergmann <bergmann@tzi.org>
4
*
5
* This file is part of the CoAP library libcoap. Please see
6
* README for terms of use.
7
*/
8
14
#ifndef _COAP_HASHKEY_H_
15
#define _COAP_HASHKEY_H_
16
17
#include "
str.h
"
18
19
typedef
unsigned
char
coap_key_t
[4];
20
21
#ifndef coap_hash
22
32
void
coap_hash_impl
(
const
unsigned
char
*s,
unsigned
int
len,
coap_key_t
h);
33
34
#define coap_hash(String,Length,Result) \
35
coap_hash_impl((String),(Length),(Result))
36
37
/* This is used to control the pre-set hash-keys for resources. */
38
#define __COAP_DEFAULT_HASH
39
#else
40
#undef __COAP_DEFAULT_HASH
41
#endif
/* coap_hash */
42
51
#define coap_str_hash(Str,H) { \
52
assert(Str); \
53
memset((H), 0, sizeof(coap_key_t)); \
54
coap_hash((H), (Str)->s, (Str)->length); \
55
}
56
57
#endif
/* _COAP_HASHKEY_H_ */
coap_key_t
unsigned char coap_key_t[4]
Definition:
hashkey.h:19
str.h
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:
hashkey.c:15
Generated on Thu May 7 2015 19:23:26 for libcoap by
1.8.6