LCOV - code coverage report
Current view: top level - src/utils - uuid.c (source / functions) Hit Total Coverage
Test: hostapd/hlr_auc_gw (AS) hwsim test run 1388338050 Lines: 0 36 0.0 %
Date: 2013-12-29 Functions: 0 3 0.0 %
Branches: 0 26 0.0 %

           Branch data     Line data    Source code
       1                 :            : /*
       2                 :            :  * Universally Unique IDentifier (UUID)
       3                 :            :  * Copyright (c) 2008, Jouni Malinen <j@w1.fi>
       4                 :            :  *
       5                 :            :  * This software may be distributed under the terms of the BSD license.
       6                 :            :  * See README for more details.
       7                 :            :  */
       8                 :            : 
       9                 :            : #include "includes.h"
      10                 :            : 
      11                 :            : #include "common.h"
      12                 :            : #include "uuid.h"
      13                 :            : 
      14                 :          0 : int uuid_str2bin(const char *str, u8 *bin)
      15                 :            : {
      16                 :            :         const char *pos;
      17                 :            :         u8 *opos;
      18                 :            : 
      19                 :          0 :         pos = str;
      20                 :          0 :         opos = bin;
      21                 :            : 
      22         [ #  # ]:          0 :         if (hexstr2bin(pos, opos, 4))
      23                 :          0 :                 return -1;
      24                 :          0 :         pos += 8;
      25                 :          0 :         opos += 4;
      26                 :            : 
      27 [ #  # ][ #  # ]:          0 :         if (*pos++ != '-' || hexstr2bin(pos, opos, 2))
      28                 :          0 :                 return -1;
      29                 :          0 :         pos += 4;
      30                 :          0 :         opos += 2;
      31                 :            : 
      32 [ #  # ][ #  # ]:          0 :         if (*pos++ != '-' || hexstr2bin(pos, opos, 2))
      33                 :          0 :                 return -1;
      34                 :          0 :         pos += 4;
      35                 :          0 :         opos += 2;
      36                 :            : 
      37 [ #  # ][ #  # ]:          0 :         if (*pos++ != '-' || hexstr2bin(pos, opos, 2))
      38                 :          0 :                 return -1;
      39                 :          0 :         pos += 4;
      40                 :          0 :         opos += 2;
      41                 :            : 
      42 [ #  # ][ #  # ]:          0 :         if (*pos++ != '-' || hexstr2bin(pos, opos, 6))
      43                 :          0 :                 return -1;
      44                 :            : 
      45                 :          0 :         return 0;
      46                 :            : }
      47                 :            : 
      48                 :            : 
      49                 :          0 : int uuid_bin2str(const u8 *bin, char *str, size_t max_len)
      50                 :            : {
      51                 :            :         int len;
      52                 :          0 :         len = os_snprintf(str, max_len, "%02x%02x%02x%02x-%02x%02x-%02x%02x-"
      53                 :            :                           "%02x%02x-%02x%02x%02x%02x%02x%02x",
      54                 :          0 :                           bin[0], bin[1], bin[2], bin[3],
      55                 :          0 :                           bin[4], bin[5], bin[6], bin[7],
      56                 :          0 :                           bin[8], bin[9], bin[10], bin[11],
      57                 :          0 :                           bin[12], bin[13], bin[14], bin[15]);
      58 [ #  # ][ #  # ]:          0 :         if (len < 0 || (size_t) len >= max_len)
      59                 :          0 :                 return -1;
      60                 :          0 :         return 0;
      61                 :            : }
      62                 :            : 
      63                 :            : 
      64                 :          0 : int is_nil_uuid(const u8 *uuid)
      65                 :            : {
      66                 :            :         int i;
      67         [ #  # ]:          0 :         for (i = 0; i < UUID_LEN; i++)
      68         [ #  # ]:          0 :                 if (uuid[i])
      69                 :          0 :                         return 0;
      70                 :          0 :         return 1;
      71                 :            : }

Generated by: LCOV version 1.9