2 * This file is part of the Palacios Virtual Machine Monitor developed
3 * by the V3VEE Project with funding from the United States National
4 * Science Foundation and the Department of Energy.
6 * The V3VEE Project is a joint project between Northwestern University
7 * and the University of New Mexico. You can find out more at
10 * Copyright (c) 2011, Peter Dinda <pdinda@northwestern.edu>
11 * Copyright (c) 2011, The V3VEE Project <http://www.v3vee.org>
12 * All rights reserved.
14 * Author: Peter Dinda <pdinda@northwestern.edu>
16 * This is free software. You are permitted to use,
17 * redistribute, and modify it as specified in the file "V3VEE_LICENSE".
21 #include <interfaces/vmm_keyed_stream.h>
22 #include <palacios/vmm.h>
23 #include <palacios/vmm_debug.h>
24 #include <palacios/vmm_types.h>
25 #include <palacios/vm_guest.h>
27 struct v3_keyed_stream_hooks * keyed_stream_hooks = 0;
29 v3_keyed_stream_t v3_keyed_stream_open(char *url, v3_keyed_stream_open_t open_type)
31 V3_ASSERT(VM_NONE, VCORE_NONE, keyed_stream_hooks != NULL);
32 V3_ASSERT(VM_NONE, VCORE_NONE, keyed_stream_hooks->open != NULL);
34 return keyed_stream_hooks->open(url,open_type);
39 void v3_keyed_stream_close(v3_keyed_stream_t stream)
41 V3_ASSERT(VM_NONE, VCORE_NONE, keyed_stream_hooks != NULL);
42 V3_ASSERT(VM_NONE, VCORE_NONE, keyed_stream_hooks->close != NULL);
44 return keyed_stream_hooks->close(stream);
49 void v3_keyed_stream_preallocate_hint_key(v3_keyed_stream_t stream, char *key, uint64_t size)
51 V3_ASSERT(VM_NONE, VCORE_NONE, keyed_stream_hooks != NULL);
52 V3_ASSERT(VM_NONE, VCORE_NONE, keyed_stream_hooks->preallocate_hint_key != NULL);
54 return keyed_stream_hooks->preallocate_hint_key(stream,key,size);
57 v3_keyed_stream_key_t v3_keyed_stream_open_key(v3_keyed_stream_t stream, char *key)
59 V3_ASSERT(VM_NONE, VCORE_NONE, keyed_stream_hooks != NULL);
60 V3_ASSERT(VM_NONE, VCORE_NONE, keyed_stream_hooks->open_key != NULL);
62 return keyed_stream_hooks->open_key(stream,key);
66 void v3_keyed_stream_close_key(v3_keyed_stream_t stream, char *key)
68 V3_ASSERT(VM_NONE, VCORE_NONE, keyed_stream_hooks != NULL);
69 V3_ASSERT(VM_NONE, VCORE_NONE, keyed_stream_hooks->close_key != NULL);
71 return keyed_stream_hooks->close_key(stream,key);
75 sint64_t v3_keyed_stream_write_key(v3_keyed_stream_t stream,
76 v3_keyed_stream_key_t key,
82 V3_ASSERT(VM_NONE, VCORE_NONE, keyed_stream_hooks != NULL);
83 V3_ASSERT(VM_NONE, VCORE_NONE, keyed_stream_hooks->write_key != NULL);
85 return keyed_stream_hooks->write_key(stream,key,tag,taglen,buf,len);
88 sint64_t v3_keyed_stream_read_key(v3_keyed_stream_t stream,
89 v3_keyed_stream_key_t key,
95 V3_ASSERT(VM_NONE, VCORE_NONE, keyed_stream_hooks != NULL);
96 V3_ASSERT(VM_NONE, VCORE_NONE, keyed_stream_hooks->read_key != NULL);
98 return keyed_stream_hooks->read_key(stream,key,tag,taglen,buf,len);
103 void V3_Init_Keyed_Streams(struct v3_keyed_stream_hooks * hooks) {
104 keyed_stream_hooks = hooks;
105 PrintDebug(VM_NONE, VCORE_NONE, "V3 keyed stream support inited\n");