1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
|
/*
* libexplain - Explain errno values returned by libc functions
* Copyright (C) 2010, 2011, 2013 Peter Miller
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <libexplain/ac/linux/if_ppp.h>
#include <libexplain/buffer/if_ppp_state.h>
#include <libexplain/buffer/pointer.h>
#include <libexplain/parse_bits.h>
#include <libexplain/is_efault.h>
#include <libexplain/sizeof.h>
#ifdef HAVE_LINUX_IF_PPP_H
static explain_parse_bits_table_t table[] =
{
{ "SC_COMP_PROT", SC_COMP_PROT },
{ "SC_COMP_AC", SC_COMP_AC },
{ "SC_COMP_TCP", SC_COMP_TCP },
{ "SC_NO_TCP_CCID", SC_NO_TCP_CCID },
{ "SC_REJ_COMP_AC", SC_REJ_COMP_AC },
{ "SC_REJ_COMP_TCP", SC_REJ_COMP_TCP },
{ "SC_CCP_OPEN", SC_CCP_OPEN },
{ "SC_CCP_UP", SC_CCP_UP },
{ "SC_ENABLE_IP", SC_ENABLE_IP },
{ "SC_LOOP_TRAFFIC", SC_LOOP_TRAFFIC },
{ "SC_MULTILINK", SC_MULTILINK },
{ "SC_MP_SHORTSEQ", SC_MP_SHORTSEQ },
{ "SC_COMP_RUN", SC_COMP_RUN },
{ "SC_DECOMP_RUN", SC_DECOMP_RUN },
{ "SC_MP_XSHORTSEQ", SC_MP_XSHORTSEQ },
{ "SC_DEBUG", SC_DEBUG },
{ "SC_LOG_INPKT", SC_LOG_INPKT },
{ "SC_LOG_OUTPKT", SC_LOG_OUTPKT },
{ "SC_LOG_RAWIN", SC_LOG_RAWIN },
{ "SC_LOG_FLUSH", SC_LOG_FLUSH },
{ "SC_SYNC", SC_SYNC },
{ "SC_MUST_COMP", SC_MUST_COMP },
{ "SC_XMIT_BUSY", SC_XMIT_BUSY },
{ "SC_RCV_ODDP", SC_RCV_ODDP },
{ "SC_RCV_EVNP", SC_RCV_EVNP },
{ "SC_RCV_B7_1", SC_RCV_B7_1 },
{ "SC_RCV_B7_0", SC_RCV_B7_0 },
{ "SC_DC_FERROR", SC_DC_FERROR },
{ "SC_DC_ERROR", SC_DC_ERROR },
};
void
explain_buffer_if_ppp_state(explain_string_buffer_t *sb, const int *data)
{
if (explain_is_efault_pointer(data, sizeof(*data)))
{
explain_buffer_pointer(sb, data);
}
else
{
explain_string_buffer_puts(sb, "{ ");
explain_parse_bits_print(sb, *data, table, SIZEOF(table));
explain_string_buffer_puts(sb, " }");
}
}
#else
void
explain_buffer_if_ppp_state(explain_string_buffer_t *sb, const int *data)
{
explain_buffer_pointer(sb, data);
}
#endif
/* vim: set ts=8 sw=4 et : */
|