1 /* 2 * Copyright (c) 2005-2008 Nominet UK (www.nic.uk) 3 * All rights reserved. 4 * Contributors: Ben Laurie, Rachel Willmer. The Contributors have asserted 5 * their moral rights under the UK Copyright Design and Patents Act 1988 to 6 * be recorded as the authors of this copyright work. 7 * 8 * Licensed under the Apache License, Version 2.0 (the "License"); you may not 9 * use this file except in compliance with the License. 10 * 11 * You may obtain a copy of the License at 12 * http://www.apache.org/licenses/LICENSE-2.0 13 * 14 * Unless required by applicable law or agreed to in writing, software 15 * distributed under the License is distributed on an "AS IS" BASIS, 16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 * 18 * See the License for the specific language governing permissions and 19 * limitations under the License. 20 */ 21 22 /** \file 23 */ 24 #ifndef OPS_MEMORY_H 25 #define OPS_MEMORY_H 26 27 #include <sys/types.h> 28 29 #include "packet.h" 30 31 /** __ops_memory_t 32 */ 33 typedef struct __ops_memory_t { 34 unsigned char *buf; 35 size_t length; 36 size_t allocated; 37 } __ops_memory_t; 38 39 40 __ops_memory_t *__ops_memory_new(void); 41 void __ops_memory_free(__ops_memory_t *); 42 void __ops_memory_init(__ops_memory_t *, size_t); 43 void __ops_memory_pad(__ops_memory_t *, size_t); 44 void __ops_memory_add(__ops_memory_t *, const unsigned char *, size_t); 45 void __ops_memory_place_int(__ops_memory_t *, unsigned, unsigned, size_t); 46 void __ops_memory_make_packet(__ops_memory_t *, __ops_content_tag_t); 47 void __ops_memory_clear(__ops_memory_t *); 48 void __ops_memory_release(__ops_memory_t *); 49 50 void __ops_writer_set_memory(__ops_create_info_t *, __ops_memory_t *); 51 52 size_t __ops_memory_get_length(const __ops_memory_t *); 53 void *__ops_memory_get_data(__ops_memory_t *); 54 55 void __ops_random(void *, size_t); 56 57 #endif 58