This repository has been archived by the owner. It is now read-only.
Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Add header file with tasks and context resource type
- Loading branch information
Hunter Morris
committed
Mar 12, 2012
1 parent
902895e
commit 16b757d3fbeb508660ee818962e9a6f0c1579c19
Showing
2 changed files
with
56 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#ifndef ERLANG_BCRYPT_BCRYPT_NIF_H | ||
#define ERLANG_BCRYPT_BCRYPT_NIF_H | ||
|
||
#include "async_queue.h" | ||
|
||
typedef unsigned char byte; | ||
|
||
char *bcrypt(const char *, const char *); | ||
void encode_salt(char *, u_int8_t *, u_int16_t, u_int8_t); | ||
|
||
typedef struct { | ||
ErlNifResourceType *bcrypt_rt; | ||
} bcrypt_privdata_t; | ||
|
||
typedef struct { | ||
async_queue_t *queue; | ||
ErlNifThreadOpts *topts; | ||
ErlNifTid tid; | ||
} ctx_t; | ||
|
||
typedef enum { | ||
UNKNOWN, | ||
SHUTDOWN, | ||
HASH | ||
} task_type_t; | ||
|
||
typedef struct { | ||
task_type_t type; | ||
ErlNifEnv *env; | ||
ErlNifPid pid; | ||
ERL_NIF_TERM ref; | ||
union { | ||
struct { | ||
ErlNifBinary salt; | ||
ErlNifBinary password; | ||
} hash; | ||
} data; | ||
} task_t; | ||
|
||
#endif // ERLANG_BCRYPT_BCRYPT_NIF_H |