util.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2005-2008 Nominet UK (www.nic.uk)
00003  * All rights reserved.
00004  * Contributors: Ben Laurie, Rachel Willmer. The Contributors have asserted
00005  * their moral rights under the UK Copyright Design and Patents Act 1988 to
00006  * be recorded as the authors of this copyright work.
00007  *
00008  * Licensed under the Apache License, Version 2.0 (the "License"); you may not
00009  * use this file except in compliance with the License. 
00010  * 
00011  * You may obtain a copy of the License at 
00012  *     http://www.apache.org/licenses/LICENSE-2.0 
00013  * 
00014  * Unless required by applicable law or agreed to in writing, software 
00015  * distributed under the License is distributed on an "AS IS" BASIS, 
00016  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
00017  * 
00018  * See the License for the specific language governing permissions and
00019  * limitations under the License.
00020  */
00021 
00025 #ifndef OPS_UTIL_H
00026 #define OPS_UTIL_H
00027 
00028 #include "openpgpsdk/types.h"
00029 #include "openpgpsdk/create.h"
00030 #include "openpgpsdk/packet-parse.h"
00031 #include <stdlib.h>
00032 
00033 #define ops_false       0
00034 #define ops_true        1
00035 
00036 void hexdump(const unsigned char *src,size_t length);
00037 
00038 /*
00039  * These macros code ensures that you are casting what you intend to cast.
00040  * It works because in "a ? b : c", b and c must have the same type.
00041  * This is a copy of the macro defined in openssl/asn1.h.
00042  */
00043 #ifndef CHECKED_PTR_OF
00044 #define CHECKED_PTR_OF(type, p) ((void*) (1 ? p : (type *)0))
00045 #endif 
00046 #define CHECKED_INSTANCE_OF(type, p) (1 ? p : (type)0) 
00047 #define DECONST(type,p) ((type *)CHECKED_PTR_OF(const type, p))
00048 
00049 /* number of elements in an array */
00050 #define OPS_ARRAY_SIZE(a)       (sizeof(a)/sizeof(*(a)))
00051 
00052 void *ops_mallocz(size_t n);
00053 
00054 #endif

Generated on Thu Jun 20 00:00:02 2013 for OpenPGP:SDK by  doxygen 1.4.6