LCOV - code coverage report
Current view: top level - lib - parser_aux.h (source / functions) Hit Total Coverage
Test: GNU Libtasn1 Lines: 16 20 80.0 %
Date: 2013-03-24 Functions: 4 4 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 6 10 60.0 %

           Branch data     Line data    Source code
       1                 :            : /*
       2                 :            :  * Copyright (C) 2000-2013 Free Software Foundation, Inc.
       3                 :            :  *
       4                 :            :  * This file is part of LIBTASN1.
       5                 :            :  *
       6                 :            :  * The LIBTASN1 library is free software; you can redistribute it
       7                 :            :  * and/or modify it under the terms of the GNU Lesser General Public
       8                 :            :  * License as published by the Free Software Foundation; either
       9                 :            :  * version 2.1 of the License, or (at your option) any later version.
      10                 :            :  *
      11                 :            :  * This library is distributed in the hope that it will be useful, but
      12                 :            :  * WITHOUT ANY WARRANTY; without even the implied warranty of
      13                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      14                 :            :  * Lesser General Public License for more details.
      15                 :            :  *
      16                 :            :  * You should have received a copy of the GNU Lesser General Public
      17                 :            :  * License along with this library; if not, write to the Free Software
      18                 :            :  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
      19                 :            :  * 02110-1301, USA
      20                 :            :  */
      21                 :            : 
      22                 :            : #ifndef _PARSER_AUX_H
      23                 :            : #define _PARSER_AUX_H
      24                 :            : 
      25                 :            : #define DER_LEN 16
      26                 :            : 
      27                 :            : /***************************************/
      28                 :            : /*  Functions used by ASN.1 parser     */
      29                 :            : /***************************************/
      30                 :            : asn1_node _asn1_add_static_node (unsigned int type);
      31                 :            : 
      32                 :            : asn1_node
      33                 :            : _asn1_set_value (asn1_node node, const void *value, unsigned int len);
      34                 :            : 
      35                 :            : asn1_node _asn1_set_value_m (asn1_node node, void *value, unsigned int len);
      36                 :            : 
      37                 :            : asn1_node
      38                 :            : _asn1_set_value_lv (asn1_node node, const void *value, unsigned int len);
      39                 :            : 
      40                 :            : asn1_node
      41                 :            : _asn1_append_value (asn1_node node, const void *value, unsigned int len);
      42                 :            : 
      43                 :            : asn1_node _asn1_set_name (asn1_node node, const char *name);
      44                 :            : 
      45                 :            : asn1_node _asn1_cpy_name (asn1_node dst, asn1_node src);
      46                 :            : 
      47                 :            : asn1_node _asn1_set_right (asn1_node node, asn1_node right);
      48                 :            : 
      49                 :            : asn1_node _asn1_get_last_right (asn1_node node);
      50                 :            : 
      51                 :            : void _asn1_remove_node (asn1_node node);
      52                 :            : 
      53                 :            : void _asn1_delete_list (void);
      54                 :            : 
      55                 :            : void _asn1_delete_list_and_nodes (void);
      56                 :            : 
      57                 :            : char *_asn1_ltostr (long v, char *str);
      58                 :            : 
      59                 :            : asn1_node _asn1_find_up (asn1_node node);
      60                 :            : 
      61                 :            : int _asn1_change_integer_value (asn1_node node);
      62                 :            : 
      63                 :            : int _asn1_expand_object_id (asn1_node node);
      64                 :            : 
      65                 :            : int _asn1_type_set_config (asn1_node node);
      66                 :            : 
      67                 :            : int _asn1_check_identifier (asn1_node node);
      68                 :            : 
      69                 :            : int _asn1_set_default_tag (asn1_node node);
      70                 :            : 
      71                 :            : /******************************************************************/
      72                 :            : /* Function : _asn1_get_right                                     */
      73                 :            : /* Description: returns the element pointed by the RIGHT field of */
      74                 :            : /*              a NODE_ASN element.                               */
      75                 :            : /* Parameters:                                                    */
      76                 :            : /*   node: NODE_ASN element pointer.                              */
      77                 :            : /* Return: field RIGHT of NODE.                                   */
      78                 :            : /******************************************************************/
      79                 :            : inline static asn1_node
      80                 :            : _asn1_get_right (asn1_node node)
      81                 :            : {
      82                 :            :   if (node == NULL)
      83                 :            :     return NULL;
      84                 :            :   return node->right;
      85                 :            : }
      86                 :            : 
      87                 :            : /******************************************************************/
      88                 :            : /* Function : _asn1_set_down                                      */
      89                 :            : /* Description: sets the field DOWN in a NODE_ASN element.        */
      90                 :            : /* Parameters:                                                    */
      91                 :            : /*   node: element pointer.                                       */
      92                 :            : /*   down: pointer to a NODE_ASN element that you want be pointed */
      93                 :            : /*          by NODE.                                              */
      94                 :            : /* Return: pointer to *NODE.                                      */
      95                 :            : /******************************************************************/
      96                 :            : inline static asn1_node
      97                 :       5447 : _asn1_set_down (asn1_node node, asn1_node down)
      98                 :            : {
      99         [ -  + ]:       5447 :   if (node == NULL)
     100                 :          0 :     return node;
     101                 :       5447 :   node->down = down;
     102         [ +  + ]:       5447 :   if (down)
     103                 :       4331 :     down->left = node;
     104                 :       5447 :   return node;
     105                 :            : }
     106                 :            : 
     107                 :            : /******************************************************************/
     108                 :            : /* Function : _asn1_get_down                                      */
     109                 :            : /* Description: returns the element pointed by the DOWN field of  */
     110                 :            : /*              a NODE_ASN element.                               */
     111                 :            : /* Parameters:                                                    */
     112                 :            : /*   node: NODE_ASN element pointer.                              */
     113                 :            : /* Return: field DOWN of NODE.                                    */
     114                 :            : /******************************************************************/
     115                 :            : inline static asn1_node
     116                 :        277 : _asn1_get_down (asn1_node node)
     117                 :            : {
     118         [ -  + ]:        277 :   if (node == NULL)
     119                 :          0 :     return NULL;
     120                 :        277 :   return node->down;
     121                 :            : }
     122                 :            : 
     123                 :            : /******************************************************************/
     124                 :            : /* Function : _asn1_get_name                                      */
     125                 :            : /* Description: returns the name of a NODE_ASN element.           */
     126                 :            : /* Parameters:                                                    */
     127                 :            : /*   node: NODE_ASN element pointer.                              */
     128                 :            : /* Return: a null terminated string.                              */
     129                 :            : /******************************************************************/
     130                 :            : inline static char *
     131                 :         30 : _asn1_get_name (asn1_node node)
     132                 :            : {
     133         [ -  + ]:         30 :   if (node == NULL)
     134                 :          0 :     return NULL;
     135                 :         30 :   return node->name;
     136                 :            : }
     137                 :            : 
     138                 :            : /******************************************************************/
     139                 :            : /* Function : _asn1_mod_type                                      */
     140                 :            : /* Description: change the field TYPE of an NODE_ASN element.     */
     141                 :            : /*              The new value is the old one | (bitwise or) the   */
     142                 :            : /*              paramener VALUE.                                  */
     143                 :            : /* Parameters:                                                    */
     144                 :            : /*   node: NODE_ASN element pointer.                              */
     145                 :            : /*   value: the integer value that must be or-ed with the current */
     146                 :            : /*          value of field TYPE.                                  */
     147                 :            : /* Return: NODE pointer.                                          */
     148                 :            : /******************************************************************/
     149                 :            : inline static asn1_node
     150                 :        470 : _asn1_mod_type (asn1_node node, unsigned int value)
     151                 :            : {
     152         [ -  + ]:        470 :   if (node == NULL)
     153                 :          0 :     return node;
     154                 :        470 :   node->type |= value;
     155                 :        470 :   return node;
     156                 :            : }
     157                 :            : 
     158                 :            : #endif

Generated by: LCOV version 1.9