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

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: Edits 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 /*
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 * CreateQuery: create an opaque query object, given an opaque context object.
Mark Seaborn 2012/03/01 00:26:20 If you could do examples, that would aid readabili
Nick Bray (chromium) 2012/03/01 01:25:16 Done.
19 * The context object contains persistant variables that will be used for all
Mark Seaborn 2012/03/01 00:26:20 'persistent'
Nick Bray (chromium) 2012/03/01 01:25:16 Done.
20 * queries, whereas the query object contains information relevant to a single
21 * validation result.
22 *
23 * AddData: add a blob of binary data to the query. Conceptually, the query
Mark Seaborn 2012/03/01 00:26:20 query->AddData(query, data, data_size); -- Adds a
24 * will concatinate all the binary data it is given, in the order it is given,
Mark Seaborn 2012/03/01 00:26:20 'concatenate'
Nick Bray (chromium) 2012/03/01 01:25:16 Done.
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 * DoQuery: the key is complete, query the validation status. AddData must
Mark Seaborn 2012/03/01 00:26:20 validation_passed = query->DoQuery(query)
Nick Bray (chromium) 2012/03/01 01:25:16 Done.
33 * not be called after calling this function.
34 *
35 * set_status: set the database entry for the given key. DoQuery must be
Mark Seaborn 2012/03/01 00:26:20 set_status doesn't match.
Nick Bray (chromium) 2012/03/01 01:25:16 Done.
36 * called first.
37 *
38 * DestroyQuery: cleanup and deallocate the query object.
39 */
40
41 typedef struct NaClValidationCache {
42 void *context;
Mark Seaborn 2012/03/01 00:26:20 Maybe 'handle'
Nick Bray (chromium) 2012/03/01 01:25:16 Done.
43 void *(*CreateQuery)(void *context);
44 void (*AddData)(void *query, const unsigned char *data, size_t length);
Mark Seaborn 2012/03/01 00:26:20 uint8_t instead of unsigned char?
Nick Bray (chromium) 2012/03/01 01:25:16 Avoids dependencies.
45 int (*DoQuery)(void *query);
Mark Seaborn 2012/03/01 00:26:20 Maybe: GetValidationStatus(), QueryValidationStatu
Nick Bray (chromium) 2012/03/01 01:25:16 Done.
46 void (*SetValidates)(void *query);
Mark Seaborn 2012/03/01 00:26:20 Maybe: SetValidationStatus(), MarkCodeValidating()
Nick Bray (chromium) 2012/03/01 01:25:16 Done.
47 void (*DestroyQuery)(void *query);
48 } NaClValidationCache;
49
50 EXTERN_C_END
51
52 #endif /* NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_VALIDATION_CACHE_H_ */
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698