libexplain  1.4.D001
libexplain/buffer/ppp_flags.c
Go to the documentation of this file.
00001 /*
00002  * libexplain - Explain errno values returned by libc functions
00003  * Copyright (C) 2010, 2011, 2013 Peter Miller
00004  *
00005  * This program is free software; you can redistribute it and/or modify
00006  * it under the terms of the GNU Lesser General Public License as
00007  * published by the Free Software Foundation; either version 3 of the
00008  * License, or (at your option) any later version.
00009  *
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013  * Lesser General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU Lesser General Public License
00016  * along with this program. If not, see <http://www.gnu.org/licenses/>.
00017  */
00018 
00019 #include <libexplain/ac/net/if_ppp.h>
00020 
00021 #include <libexplain/buffer/pointer.h>
00022 #include <libexplain/buffer/ppp_flags.h>
00023 #include <libexplain/parse_bits.h>
00024 #include <libexplain/is_efault.h>
00025 
00026 
00027 void
00028 explain_buffer_ppp_flags(explain_string_buffer_t *sb, int value)
00029 {
00030     static const explain_parse_bits_table_t table[] =
00031     {
00032 #ifdef SC_COMP_PROT
00033         { "SC_COMP_PROT", SC_COMP_PROT },
00034 #endif
00035 #ifdef SC_COMP_AC
00036         { "SC_COMP_AC", SC_COMP_AC },
00037 #endif
00038 #ifdef SC_COMP_TCP
00039         { "SC_COMP_TCP", SC_COMP_TCP },
00040 #endif
00041 #ifdef SC_NO_TCP_CCID
00042         { "SC_NO_TCP_CCID", SC_NO_TCP_CCID },
00043 #endif
00044 #ifdef SC_REJ_COMP_AC
00045         { "SC_REJ_COMP_AC", SC_REJ_COMP_AC },
00046 #endif
00047 #ifdef SC_REJ_COMP_TCP
00048         { "SC_REJ_COMP_TCP", SC_REJ_COMP_TCP },
00049 #endif
00050 #ifdef SC_CCP_OPEN
00051         { "SC_CCP_OPEN", SC_CCP_OPEN },
00052 #endif
00053 #ifdef SC_CCP_UP
00054         { "SC_CCP_UP", SC_CCP_UP },
00055 #endif
00056 #ifdef SC_ENABLE_IP
00057         { "SC_ENABLE_IP", SC_ENABLE_IP },
00058 #endif
00059 #ifdef SC_LOOP_TRAFFIC
00060         { "SC_LOOP_TRAFFIC", SC_LOOP_TRAFFIC },
00061 #endif
00062 #ifdef SC_MULTILINK
00063         { "SC_MULTILINK", SC_MULTILINK },
00064 #endif
00065 #ifdef SC_MP_SHORTSEQ
00066         { "SC_MP_SHORTSEQ", SC_MP_SHORTSEQ },
00067 #endif
00068 #ifdef SC_COMP_RUN
00069         { "SC_COMP_RUN", SC_COMP_RUN },
00070 #endif
00071 #ifdef SC_DECOMP_RUN
00072         { "SC_DECOMP_RUN", SC_DECOMP_RUN },
00073 #endif
00074 #ifdef SC_MP_XSHORTSEQ
00075         { "SC_MP_XSHORTSEQ", SC_MP_XSHORTSEQ },
00076 #endif
00077 #ifdef SC_DEBUG
00078         { "SC_DEBUG", SC_DEBUG },
00079 #endif
00080 #ifdef SC_LOG_INPKT
00081         { "SC_LOG_INPKT", SC_LOG_INPKT },
00082 #endif
00083 #ifdef SC_LOG_OUTPKT
00084         { "SC_LOG_OUTPKT", SC_LOG_OUTPKT },
00085 #endif
00086 #ifdef SC_LOG_RAWIN
00087         { "SC_LOG_RAWIN", SC_LOG_RAWIN },
00088 #endif
00089 #ifdef SC_LOG_FLUSH
00090         { "SC_LOG_FLUSH", SC_LOG_FLUSH },
00091 #endif
00092 #ifdef SC_SYNC
00093         { "SC_SYNC", SC_SYNC },
00094 #endif
00095 #ifdef SC_MUST_COMP
00096         { "SC_MUST_COMP", SC_MUST_COMP },
00097 #endif
00098     };
00099 
00100     explain_parse_bits_print(sb, value, table, SIZEOF(table));
00101 }
00102 
00103 
00104 void
00105 explain_buffer_ppp_flags_star(explain_string_buffer_t *sb, const int *data)
00106 {
00107     if (explain_is_efault_pointer(data, sizeof(*data)))
00108     {
00109         explain_buffer_pointer(sb, data);
00110     }
00111     else
00112     {
00113         explain_string_buffer_puts(sb, "{ ");
00114         explain_buffer_ppp_flags(sb, *data);
00115         explain_string_buffer_puts(sb, " }");
00116     }
00117 }
00118 
00119 
00120 /* vim: set ts=8 sw=4 et : */