Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(57)

Side by Side Diff: src/trusted/validator/validation_cache.h

Issue 9535001: Add validation caching interface. (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client
Patch Set: Bugfix Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 /*
Mark Seaborn 2012/02/29 21:33:34 Create a subdirectory for these files, e.g. 'trust
Nick Bray (chromium) 2012/02/29 22:58:09 Why? A directory for two files, and adding a buil
2 * Copyright (c) 2012 The Native Client Authors. All rights reserved.
3 * Use of this source code is governed by a BSD-style license that can be
4 * found in the LICENSE file.
5 */
6
7 #ifndef NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_VALIDATION_CACHE_H_
8 #define NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_VALIDATION_CACHE_H_
9
10 #include "native_client/src/include/nacl_base.h"
11
12 EXTERN_C_BEGIN
13
14 /*
15 * This interface allows the validator to query a database of validation results
16 * while hiding details of how the database is implemented.
17 *
18 * create_query: create an opaque query object, given an opaque context object.
19 * The context object contains persistant variables that will be used for all
20 * queries, whereas the query object contains information relevant to a single
21 * validation result.
22 *
23 * add_data: add a blob of binary data to the query. Conceptually, the query
24 * will concatinate all the binary data it is given, in the order it is given,
25 * and use the concatenated blob as a key to look up validation results in a
26 * database. In practice, all of the data is hashed into a reasonabally sized
27 * key. The validation cache doesn't care what data it is given, it is the
28 * responsibility of the validator to provide enough information to uniquely
29 * identify the validation result. This gives flexibility to use different
30 * types of keys for different validators and different sources of code.
31 *
32 * do_query: the key is complete, query the validation status. add_data must
33 * not be called after calling this function.
34 *
35 * set_status: set the database entry for the given key. do_query must be
36 * called first.
37 *
38 * destroy_query: cleanup and deallocate the query object.
39 */
40
41 typedef struct NaClValidationCache {
Mark Seaborn 2012/02/29 21:33:34 Maybe 'NaClValidationCacheFuncs', because this isn
Nick Bray (chromium) 2012/02/29 22:58:09 I wanted to avoid embedding to many implementation
42 void *(*create_query)(void *context);
Mark Seaborn 2012/02/29 21:33:34 -> CreateQuery. We use CamelCase for method names
Nick Bray (chromium) 2012/02/29 22:58:09 Done.
43 void (*add_data)(void *query, const unsigned char *data, size_t length);
44 int (*do_query)(void *query);
45 void (*set_validates)(void *query);
46 void (*destroy_query)(void *query);
47 } NaClValidationCache;
Mark Seaborn 2012/02/29 21:33:34 How about adding 'void *context' as a member of th
Nick Bray (chromium) 2012/02/29 22:58:09 Done.
48
49 EXTERN_C_END
50
51 #endif /* NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_VALIDATION_CACHE_H_ */
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698