LCOV - code coverage report
Current view: top level - plugins/nat/lib - lib.c (source / functions) Hit Total Coverage
Test: coverage-filtered.info Lines: 7 14 50.0 %
Date: 2023-10-26 01:39:38 Functions: 1 2 50.0 %

          Line data    Source code
       1             : /*
       2             :  * Copyright (c) 2020 Cisco and/or its affiliates.
       3             :  * Licensed under the Apache License, Version 2.0 (the "License");
       4             :  * you may not use this file except in compliance with the License.
       5             :  * You may obtain a copy of the License at:
       6             :  *
       7             :  *     http://www.apache.org/licenses/LICENSE-2.0
       8             :  *
       9             :  * Unless required by applicable law or agreed to in writing, software
      10             :  * distributed under the License is distributed on an "AS IS" BASIS,
      11             :  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      12             :  * See the License for the specific language governing permissions and
      13             :  * limitations under the License.
      14             :  */
      15             : 
      16             : #include <nat/lib/lib.h>
      17             : #include <nat/lib/nat_proto.h>
      18             : 
      19             : uword
      20           0 : unformat_nat_protocol (unformat_input_t *input, va_list *args)
      21             : {
      22           0 :   u32 *r = va_arg (*args, u32 *);
      23             : 
      24             :   if (0)
      25             :     ;
      26             : #define _(N, i, n, s) else if (unformat (input, s)) *r = NAT_PROTOCOL_##N;
      27           0 :   foreach_nat_protocol
      28             : #undef _
      29           0 :     else return 0;
      30           0 :   return 1;
      31             : }
      32             : 
      33             : u8 *
      34       41883 : format_nat_protocol (u8 *s, va_list *args)
      35             : {
      36       41883 :   u32 i = va_arg (*args, u32);
      37       41883 :   u8 *t = 0;
      38             : 
      39       41883 :   switch (i)
      40             :     {
      41             : #define _(N, j, n, str)                                                       \
      42             :   case NAT_PROTOCOL_##N:                                                      \
      43             :     t = (u8 *) str;                                                           \
      44             :     break;
      45       41883 :       foreach_nat_protocol
      46             : #undef _
      47           0 :         default : s = format (s, "unknown");
      48           0 :       return s;
      49             :     }
      50       41883 :   s = format (s, "%s", t);
      51       41883 :   return s;
      52             : }
      53             : 
      54             : /*
      55             :  * fd.io coding-style-patch-verification: ON
      56             :  *
      57             :  * Local Variables:
      58             :  * eval: (c-set-style "gnu")
      59             :  * End:
      60             :  */

Generated by: LCOV version 1.14