security/nss/lib/util/seccomon.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 /* This Source Code Form is subject to the terms of the Mozilla Public
     2  * License, v. 2.0. If a copy of the MPL was not distributed with this
     3  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     5 /*
     6  * seccomon.h - common data structures for security libraries
     7  *
     8  * This file should have lowest-common-denominator datastructures
     9  * for security libraries.  It should not be dependent on any other
    10  * headers, and should not require linking with any libraries.
    11  */
    13 #ifndef _SECCOMMON_H_
    14 #define _SECCOMMON_H_
    16 #include "utilrename.h"
    17 #include "prtypes.h"
    20 #ifdef __cplusplus 
    21 # define SEC_BEGIN_PROTOS extern "C" {
    22 # define SEC_END_PROTOS }
    23 #else
    24 # define SEC_BEGIN_PROTOS
    25 # define SEC_END_PROTOS
    26 #endif
    28 #include "secport.h"
    30 typedef enum {
    31     siBuffer = 0,
    32     siClearDataBuffer = 1,
    33     siCipherDataBuffer = 2,
    34     siDERCertBuffer = 3,
    35     siEncodedCertBuffer = 4,
    36     siDERNameBuffer = 5,
    37     siEncodedNameBuffer = 6,
    38     siAsciiNameString = 7,
    39     siAsciiString = 8,
    40     siDEROID = 9,
    41     siUnsignedInteger = 10,
    42     siUTCTime = 11,
    43     siGeneralizedTime = 12,
    44     siVisibleString = 13,
    45     siUTF8String = 14,
    46     siBMPString = 15
    47 } SECItemType;
    49 typedef struct SECItemStr SECItem;
    51 struct SECItemStr {
    52     SECItemType type;
    53     unsigned char *data;
    54     unsigned int len;
    55 };
    57 typedef struct SECItemArrayStr SECItemArray;
    59 struct SECItemArrayStr {
    60     SECItem *items;
    61     unsigned int len;
    62 };
    64 /*
    65 ** A status code. Status's are used by procedures that return status
    66 ** values. Again the motivation is so that a compiler can generate
    67 ** warnings when return values are wrong. Correct testing of status codes:
    68 **
    69 **	SECStatus rv;
    70 **	rv = some_function (some_argument);
    71 **	if (rv != SECSuccess)
    72 **		do_an_error_thing();
    73 **
    74 */
    75 typedef enum _SECStatus {
    76     SECWouldBlock = -2,
    77     SECFailure = -1,
    78     SECSuccess = 0
    79 } SECStatus;
    81 /*
    82 ** A comparison code. Used for procedures that return comparision
    83 ** values. Again the motivation is so that a compiler can generate
    84 ** warnings when return values are wrong.
    85 */
    86 typedef enum _SECComparison {
    87     SECLessThan = -1,
    88     SECEqual = 0,
    89     SECGreaterThan = 1
    90 } SECComparison;
    92 #endif /* _SECCOMMON_H_ */

mercurial