libexplain
1.4.D001
|
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/ppp_defs.h> 00020 00021 #include <libexplain/buffer/int32_t.h> 00022 #include <libexplain/buffer/ppp_comp_stats.h> 00023 #include <libexplain/buffer/pointer.h> 00024 #include <libexplain/is_efault.h> 00025 00026 00027 #ifdef SIOCGPPPCSTATS 00028 00029 static void 00030 explain_buffer_compstat(explain_string_buffer_t *sb, 00031 const struct compstat *data) 00032 { 00033 explain_string_buffer_puts(sb, "{ unc_bytes = "); 00034 explain_buffer_uint32_t(sb, data->unc_bytes); 00035 explain_string_buffer_puts(sb, ", unc_packets = "); 00036 explain_buffer_uint32_t(sb, data->unc_packets); 00037 explain_string_buffer_puts(sb, ", comp_bytes = "); 00038 explain_buffer_uint32_t(sb, data->comp_bytes); 00039 explain_string_buffer_puts(sb, ", comp_packets = "); 00040 explain_buffer_uint32_t(sb, data->comp_packets); 00041 explain_string_buffer_puts(sb, ", inc_bytes = "); 00042 explain_buffer_uint32_t(sb, data->inc_bytes); 00043 explain_string_buffer_puts(sb, ", inc_packets = "); 00044 explain_buffer_uint32_t(sb, data->inc_packets); 00045 explain_string_buffer_puts(sb, ", in_count = "); 00046 explain_buffer_uint32_t(sb, data->in_count); 00047 explain_string_buffer_puts(sb, ", bytes_out = "); 00048 explain_buffer_uint32_t(sb, data->bytes_out); 00049 explain_string_buffer_puts(sb, " }"); 00050 } 00051 00052 00053 void 00054 explain_buffer_ppp_comp_stats(explain_string_buffer_t *sb, 00055 const struct ppp_comp_stats *data) 00056 { 00057 if (explain_is_efault_pointer(data, sizeof(*data))) 00058 { 00059 explain_buffer_pointer(sb, data); 00060 return; 00061 } 00062 00063 explain_string_buffer_puts(sb, "{ c = "); 00064 explain_buffer_compstat(sb, &data->c); 00065 explain_string_buffer_puts(sb, ", d = "); 00066 explain_buffer_compstat(sb, &data->c); 00067 explain_string_buffer_puts(sb, " }"); 00068 } 00069 00070 !@#$ 00071 #else 00072 00073 void 00074 explain_buffer_ppp_comp_stats(explain_string_buffer_t *sb, 00075 const struct ppp_comp_stats *data) 00076 { 00077 explain_buffer_pointer(sb, data); 00078 } 00079 00080 #endif 00081 00082 00083 /* vim: set ts=8 sw=4 et : */