tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

seccomon.h (2163B)


      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/. */
      4 
      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 */
     12 
     13 #ifndef _SECCOMMON_H_
     14 #define _SECCOMMON_H_
     15 
     16 #include "utilrename.h"
     17 #include "prtypes.h"
     18 
     19 #ifdef __cplusplus
     20 #define SEC_BEGIN_PROTOS extern "C" {
     21 #define SEC_END_PROTOS }
     22 #else
     23 #define SEC_BEGIN_PROTOS
     24 #define SEC_END_PROTOS
     25 #endif
     26 
     27 #include "secport.h"
     28 
     29 typedef enum {
     30    siBuffer = 0,
     31    siClearDataBuffer = 1,
     32    siCipherDataBuffer = 2,
     33    siDERCertBuffer = 3,
     34    siEncodedCertBuffer = 4,
     35    siDERNameBuffer = 5,
     36    siEncodedNameBuffer = 6,
     37    siAsciiNameString = 7,
     38    siAsciiString = 8,
     39    siDEROID = 9,
     40    siUnsignedInteger = 10,
     41    siUTCTime = 11,
     42    siGeneralizedTime = 12,
     43    siVisibleString = 13,
     44    siUTF8String = 14,
     45    siBMPString = 15
     46 } SECItemType;
     47 
     48 typedef struct SECItemStr SECItem;
     49 
     50 struct SECItemStr {
     51    SECItemType type;
     52    unsigned char *data;
     53    unsigned int len;
     54 };
     55 
     56 typedef struct SECItemArrayStr SECItemArray;
     57 
     58 struct SECItemArrayStr {
     59    SECItem *items;
     60    unsigned int len;
     61 };
     62 
     63 /*
     64 ** A status code. Statuses are used by procedures that return status
     65 ** values. Again the motivation is so that a compiler can generate
     66 ** warnings when return values are wrong. Correct testing of status codes:
     67 **
     68 **  SECStatus rv;
     69 **  rv = some_function (some_argument);
     70 **  if (rv != SECSuccess)
     71 **      do_an_error_thing();
     72 **
     73 */
     74 typedef enum _SECStatus {
     75    SECWouldBlock = -2,
     76    SECFailure = -1,
     77    SECSuccess = 0
     78 } SECStatus;
     79 
     80 /*
     81 ** A comparison code. Used for procedures that return comparison
     82 ** values. Again the motivation is so that a compiler can generate
     83 ** warnings when return values are wrong.
     84 */
     85 typedef enum _SECComparison {
     86    SECLessThan = -1,
     87    SECEqual = 0,
     88    SECGreaterThan = 1
     89 } SECComparison;
     90 
     91 #endif /* _SECCOMMON_H_ */