libexplain
1.4.D001
|
00001 00002 /* 00003 * libexplain - Explain errno values returned by libc functions 00004 * Copyright (C) 2008, 2009, 2011, 2013 Peter Miller 00005 * 00006 * This program is free software; you can redistribute it and/or modify 00007 * it under the terms of the GNU Lesser General Public License as 00008 * published by the Free Software Foundation; either version 3 of the 00009 * License, or (at your option) any later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 * Lesser General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU Lesser General Public License 00017 * along with this program. If not, see <http://www.gnu.org/licenses/>. 00018 */ 00019 00020 #include <libexplain/ac/arpa/inet.h> 00021 #include <libexplain/ac/linux/atalk.h> 00022 #include <libexplain/ac/linux/atm.h> 00023 #include <libexplain/ac/linux/if_pppox.h> 00024 #include <libexplain/ac/linux/irda.h> 00025 #include <libexplain/ac/linux/netlink.h> 00026 #include <libexplain/ac/linux/x25.h> 00027 #include <libexplain/ac/netash/ash.h> 00028 #include <libexplain/ac/netdb.h> 00029 #include <libexplain/ac/neteconet/ec.h> 00030 #include <libexplain/ac/netinet/in.h> 00031 #include <libexplain/ac/netipx/ipx.h> 00032 #include <libexplain/ac/netiucv/iucv.h> 00033 #include <libexplain/ac/netpacket/packet.h> 00034 #include <libexplain/ac/netrose/rose.h> 00035 #include <libexplain/ac/sys/socket.h> 00036 #include <libexplain/ac/sys/un.h> 00037 00038 #include <libexplain/buffer/hexdump.h> 00039 #include <libexplain/buffer/in6_addr.h> 00040 #include <libexplain/buffer/pointer.h> 00041 #include <libexplain/buffer/sockaddr.h> 00042 #include <libexplain/buffer/address_family.h> 00043 #include <libexplain/option.h> 00044 #include <libexplain/is_efault.h> 00045 00046 00047 /* 00048 * See unix(7) for more information. 00049 */ 00050 static void 00051 explain_buffer_sockaddr_af_unix(explain_string_buffer_t *sb, 00052 const struct sockaddr_un *sa, size_t sa_len) 00053 { 00054 if (sa_len > sizeof(sa->sun_family)) 00055 { 00056 explain_string_buffer_puts(sb, ", sun_path = "); 00057 explain_string_buffer_puts_quoted(sb, sa->sun_path); 00058 } 00059 } 00060 00061 00062 void 00063 explain_buffer_in_addr(explain_string_buffer_t *sb, 00064 const struct in_addr *addr) 00065 { 00066 explain_string_buffer_puts(sb, inet_ntoa(*addr)); 00067 if (ntohl(addr->s_addr) == INADDR_ANY) 00068 { 00069 explain_string_buffer_puts(sb, " INADDR_ANY"); 00070 } 00071 else if (ntohl(addr->s_addr) == INADDR_BROADCAST) 00072 { 00073 explain_string_buffer_puts(sb, " INADDR_BROADCAST"); 00074 } 00075 else if (explain_option_dialect_specific()) 00076 { 00077 struct hostent *hep; 00078 00079 /* 00080 * We make this dialect specific, because different systems will 00081 * have different entries in their /etc/hosts file, or there 00082 * could be transient DNS failures, and these could cause false 00083 * negatives for automated testing. 00084 */ 00085 /* FIXME: gethostbyaddr_r if available */ 00086 hep = gethostbyaddr(addr, sizeof(addr), AF_INET); 00087 if (hep) 00088 { 00089 explain_string_buffer_putc(sb, ' '); 00090 explain_string_buffer_puts_quoted(sb, hep->h_name); 00091 } 00092 } 00093 } 00094 00095 00096 /* 00097 * See ip(7) and inet(3) for more information. 00098 */ 00099 static void 00100 explain_buffer_sockaddr_af_inet(explain_string_buffer_t *sb, 00101 const struct sockaddr_in *sa, size_t sa_len) 00102 { 00103 unsigned short port; 00104 00105 /* 00106 * print the port number, and name if we can 00107 */ 00108 (void)sa_len; 00109 port = ntohs(sa->sin_port); 00110 explain_string_buffer_printf(sb, ", sin_port = %u", port); 00111 if (explain_option_dialect_specific()) 00112 { 00113 struct servent *sep; 00114 00115 /* 00116 * We make this dialect specific, because different systems will 00117 * have different entries in their /etc/services file, and this 00118 * could cause false negatives for automated testing. 00119 */ 00120 /* FIXME: use getservbyport_r if available */ 00121 sep = getservbyport(sa->sin_port, "tcp"); 00122 if (!sep) 00123 sep = getservbyport(sa->sin_port, "udp"); 00124 if (sep) 00125 { 00126 explain_string_buffer_putc(sb, ' '); 00127 explain_string_buffer_puts_quoted(sb, sep->s_name); 00128 } 00129 } 00130 00131 /* 00132 * print the IP address, and name if we can 00133 */ 00134 explain_string_buffer_puts(sb, ", sin_addr = "); 00135 explain_buffer_in_addr(sb, &sa->sin_addr); 00136 } 00137 00138 00139 #ifdef AF_AX25 00140 #ifdef HAVE_LINUX_X25_H 00141 00142 static void 00143 explain_buffer_sockaddr_af_ax25(explain_string_buffer_t *sb, 00144 const struct sockaddr_ax25 *sa, size_t sa_len) 00145 { 00146 /* amateur radio stuff */ 00147 explain_string_buffer_putc(sb, ','); 00148 /* FIXME: decode sockaddr_ax25 */ 00149 if (sa_len > sizeof(*sa)) 00150 sa_len = sizeof(*sa); 00151 explain_buffer_hexdump(sb, sa, sa_len); 00152 /* file /usr/include/netax25/ax25.h */ 00153 } 00154 00155 #endif 00156 #endif 00157 00158 #ifdef AF_IPX 00159 00160 static void 00161 explain_buffer_sockaddr_af_ipx(explain_string_buffer_t *sb, 00162 const struct sockaddr_ipx *sa, size_t sa_len) 00163 { 00164 explain_string_buffer_putc(sb, ','); 00165 /* FIXME: decode sockaddr_ipx */ 00166 if (sa_len > sizeof(*sa)) 00167 sa_len = sizeof(*sa); 00168 explain_buffer_hexdump(sb, sa, sa_len); 00169 /* file /usr/include/netipx/ipx.h */ 00170 } 00171 00172 #endif 00173 00174 #ifdef AF_APPLETALK 00175 00176 static void 00177 explain_buffer_sockaddr_af_appletalk(explain_string_buffer_t *sb, 00178 const struct sockaddr_at *sa, size_t sa_len) 00179 { 00180 explain_string_buffer_putc(sb, ','); 00181 /* FIXME: decode sockaddr_at */ 00182 if (sa_len > sizeof(*sa)) 00183 sa_len = sizeof(*sa); 00184 explain_buffer_hexdump(sb, sa, sa_len); 00185 /* 00186 * file /usr/include/linux/atalk.h 00187 * sat_port 00188 * sat_addr 00189 */ 00190 } 00191 00192 #endif 00193 00194 #ifdef AF_NETROM 00195 00196 static void 00197 explain_buffer_sockaddr_af_netrom(explain_string_buffer_t *sb, 00198 const struct sockaddr *sa, size_t sa_len) 00199 { 00200 /* amateur radio stuff */ 00201 explain_string_buffer_putc(sb, ','); 00202 /* FIXME: decode sockaddr_netrom */ 00203 if (sa_len > sizeof(*sa)) 00204 sa_len = sizeof(*sa); 00205 explain_buffer_hexdump(sb, sa, sa_len); 00206 /* file /usr/include/netrom/netrom.h */ 00207 } 00208 00209 #endif 00210 00211 #ifdef AF_BRIDGE 00212 00213 static void 00214 explain_buffer_sockaddr_af_bridge(explain_string_buffer_t *sb, 00215 const struct sockaddr *sa, size_t sa_len) 00216 { 00217 explain_string_buffer_putc(sb, ','); 00218 /* FIXME: decode sockaddr_bridge */ 00219 if (sa_len > sizeof(*sa)) 00220 sa_len = sizeof(*sa); 00221 explain_buffer_hexdump(sb, sa, sa_len); 00222 } 00223 00224 #endif 00225 00226 #ifdef AF_ATMPVC 00227 #ifdef HAVE_LINUX_ATM_H 00228 00229 static void 00230 explain_buffer_sockaddr_af_atmpvc(explain_string_buffer_t *sb, 00231 const struct sockaddr_atmpvc *sa, size_t sa_len) 00232 { 00233 explain_string_buffer_putc(sb, ','); 00234 /* FIXME: decode sockaddr_atmpvc */ 00235 if (sa_len > sizeof(*sa)) 00236 sa_len = sizeof(*sa); 00237 explain_buffer_hexdump(sb, sa, sa_len); 00238 /* file /usr/include/linux/atm.h */ 00239 } 00240 00241 #endif 00242 #endif 00243 00244 #ifdef AF_X25 00245 #ifdef HAVE_LINUX_X25_H 00246 00247 /* 00248 * See x25(7) for more information. 00249 */ 00250 static void 00251 explain_buffer_sockaddr_af_x25(explain_string_buffer_t *sb, 00252 const struct sockaddr_x25 *sa, size_t sa_len) 00253 { 00254 (void)sa_len; 00255 explain_string_buffer_puts(sb, ", sx25_addr = "); 00256 explain_string_buffer_puts_quoted(sb, sa->sx25_addr.x25_addr); 00257 } 00258 00259 #endif 00260 #endif 00261 00262 #ifdef AF_INET6 00263 00264 /* 00265 * See man ipv6(7) for more information. 00266 */ 00267 static void 00268 explain_buffer_sockaddr_af_inet6(explain_string_buffer_t *sb, 00269 const struct sockaddr_in6 *sa, size_t sa_len) 00270 { 00271 unsigned short port; 00272 00273 /* 00274 * print the port number, and name if we can 00275 */ 00276 (void)sa_len; 00277 port = ntohs(sa->sin6_port); 00278 explain_string_buffer_printf(sb, ", sin_port = %u", port); 00279 if (explain_option_dialect_specific()) 00280 { 00281 struct servent *sep; 00282 00283 /* 00284 * We make this dialect specific, because different systems will 00285 * have different entries in their /etc/services file, and this 00286 * could cause false negatives for automated testing. 00287 */ 00288 /* FIXME: use getservbyport_r if available */ 00289 sep = getservbyport(port, "tcp"); 00290 if (!sep) 00291 sep = getservbyport(port, "udp"); 00292 if (sep) 00293 { 00294 explain_string_buffer_putc(sb, ' '); 00295 explain_string_buffer_puts_quoted(sb, sep->s_name); 00296 } 00297 } 00298 00299 if (sa->sin6_flowinfo != 0) 00300 { 00301 explain_string_buffer_printf 00302 ( 00303 sb, 00304 ", sin6_flowinfo = %ld", 00305 (long)sa->sin6_flowinfo 00306 ); 00307 } 00308 00309 /* 00310 * print the IP address, and name if we can 00311 */ 00312 explain_string_buffer_puts(sb, ", sin6_addr = "); 00313 explain_buffer_in6_addr(sb, &sa->sin6_addr); 00314 if (explain_option_dialect_specific()) 00315 { 00316 struct hostent *hep; 00317 00318 /* 00319 * We make this dialect specific, because different systems will 00320 * have different entries in their /etc/hosts file, or there 00321 * could be transient DNS failures, and these could cause false 00322 * negatives for automated testing. 00323 */ 00324 /* FIXME: gethostbyaddr_r if available */ 00325 hep = gethostbyaddr(&sa->sin6_addr, sizeof(sa->sin6_addr), AF_INET6); 00326 if (hep) 00327 { 00328 explain_string_buffer_putc(sb, ' '); 00329 explain_string_buffer_puts_quoted(sb, hep->h_name); 00330 } 00331 } 00332 00333 if (sa->sin6_scope_id != 0) 00334 { 00335 /* 00336 * sin6_scope_id is an ID of depending of on the scope of the 00337 * address. It is new in Linux 2.4. Linux only supports it for 00338 * link scope addresses, in that case sin6_scope_id contains the 00339 * interface index (see netdevice(7)) 00340 */ 00341 explain_string_buffer_printf 00342 ( 00343 sb, 00344 ", sin6_scope_id = %ld", 00345 (long)sa->sin6_scope_id 00346 ); 00347 } 00348 } 00349 00350 #endif 00351 00352 #ifdef AF_ROSE 00353 00354 static void 00355 explain_buffer_sockaddr_af_rose(explain_string_buffer_t *sb, 00356 const struct sockaddr_rose *sa, size_t sa_len) 00357 { 00358 /* amateur radio stuff */ 00359 explain_string_buffer_putc(sb, ','); 00360 /* FIXME: decode sockaddr_rose */ 00361 if (sa_len > sizeof(*sa)) 00362 sa_len = sizeof(*sa); 00363 explain_buffer_hexdump(sb, sa, sa_len); 00364 /* file /usr/include/netrose/rose.h */ 00365 } 00366 00367 #endif 00368 00369 #ifdef AF_DECnet 00370 00371 static void 00372 explain_buffer_sockaddr_af_decnet(explain_string_buffer_t *sb, 00373 const struct sockaddr *sa, size_t sa_len) 00374 { 00375 explain_string_buffer_putc(sb, ','); 00376 /* FIXME: decode sockaddr_decnet */ 00377 if (sa_len > sizeof(*sa)) 00378 sa_len = sizeof(*sa); 00379 explain_buffer_hexdump(sb, sa, sa_len); 00380 } 00381 00382 #endif 00383 00384 #ifdef AF_NETBEUI 00385 00386 static void 00387 explain_buffer_sockaddr_af_netbeui(explain_string_buffer_t *sb, 00388 const struct sockaddr *sa, size_t sa_len) 00389 { 00390 explain_string_buffer_putc(sb, ','); 00391 if (sa_len > sizeof(*sa)) 00392 sa_len = sizeof(*sa); 00393 /* FIXME: decode sockaddr_netbeui */ 00394 explain_buffer_hexdump(sb, sa, sa_len); 00395 } 00396 00397 #endif 00398 00399 #ifdef AF_SECURITY 00400 00401 static void 00402 explain_buffer_sockaddr_af_security(explain_string_buffer_t *sb, 00403 const struct sockaddr *sa, size_t sa_len) 00404 { 00405 explain_string_buffer_putc(sb, ','); 00406 /* FIXME: decode sockaddr_security */ 00407 if (sa_len > sizeof(*sa)) 00408 sa_len = sizeof(*sa); 00409 explain_buffer_hexdump(sb, sa, sa_len); 00410 } 00411 00412 #endif 00413 00414 #ifdef AF_KEY 00415 00416 static void 00417 explain_buffer_sockaddr_af_key(explain_string_buffer_t *sb, 00418 const struct sockaddr *sa, size_t sa_len) 00419 { 00420 explain_string_buffer_putc(sb, ','); 00421 /* FIXME: decode sockaddr_key */ 00422 if (sa_len > sizeof(*sa)) 00423 sa_len = sizeof(*sa); 00424 explain_buffer_hexdump(sb, sa, sa_len); 00425 } 00426 00427 #endif 00428 00429 #ifdef AF_NETLINK 00430 #ifdef HAVE_LINUX_NETLINK_H 00431 00432 static void 00433 explain_buffer_sockaddr_af_netlink(explain_string_buffer_t *sb, 00434 const struct sockaddr_nl *sa, size_t sa_len) 00435 { 00436 explain_string_buffer_putc(sb, ','); 00437 /* FIXME: decode sockaddr_nl */ 00438 if (sa_len > sizeof(*sa)) 00439 sa_len = sizeof(*sa); 00440 explain_buffer_hexdump(sb, sa, sa_len); 00441 /* file /usr/include/linux/netlink.h */ 00442 } 00443 00444 #endif 00445 #endif 00446 00447 #ifdef AF_PACKET 00448 00449 static void 00450 explain_buffer_sockaddr_af_packet(explain_string_buffer_t *sb, 00451 const struct sockaddr_ll *sa, size_t sa_len) 00452 { 00453 unsigned alen; 00454 00455 explain_string_buffer_puts(sb, ", "); 00456 if (sa_len < sizeof(*sa)) 00457 { 00458 explain_buffer_hexdump(sb, sa, sa_len); 00459 return; 00460 } 00461 explain_string_buffer_printf 00462 ( 00463 sb, 00464 "sll_protocol = %u, ", 00465 sa->sll_protocol 00466 ); 00467 explain_string_buffer_printf(sb, "sll_ifindex = %d, ", sa->sll_ifindex); 00468 explain_string_buffer_printf(sb, "sll_hatype = %u, ", sa->sll_hatype); 00469 explain_string_buffer_printf(sb, "sll_pkttype = %u, ", sa->sll_pkttype); 00470 explain_string_buffer_printf(sb, "sll_halen = %u, ", sa->sll_halen); 00471 explain_string_buffer_puts(sb, "sll_addr = { "); 00472 alen = sa->sll_halen; 00473 if (alen > sizeof(sa->sll_addr)) 00474 alen = sizeof(sa->sll_addr); 00475 explain_buffer_hexdump(sb, sa->sll_addr, alen); 00476 explain_string_buffer_puts(sb, " }"); 00477 } 00478 00479 #endif 00480 00481 #ifdef AF_ASH 00482 00483 static void 00484 explain_buffer_sockaddr_af_ash(explain_string_buffer_t *sb, 00485 const struct sockaddr_ash *sa, size_t sa_len) 00486 { 00487 explain_string_buffer_putc(sb, ','); 00488 /* FIXME: decode sockaddr_ash */ 00489 if (sa_len > sizeof(*sa)) 00490 sa_len = sizeof(*sa); 00491 explain_buffer_hexdump(sb, sa, sa_len); 00492 /* file /usr/include/netash/ash.h */ 00493 } 00494 00495 #endif 00496 00497 #ifdef AF_ECONET 00498 00499 static void 00500 explain_buffer_sockaddr_af_econet(explain_string_buffer_t *sb, 00501 const struct sockaddr_ec *sa, size_t sa_len) 00502 { 00503 explain_string_buffer_putc(sb, ','); 00504 /* FIXME: decode sockaddr_ec */ 00505 if (sa_len > sizeof(*sa)) 00506 sa_len = sizeof(*sa); 00507 explain_buffer_hexdump(sb, sa, sa_len); 00508 /* file /usr/include/neteconet/ec.h */ 00509 } 00510 00511 #endif 00512 00513 #ifdef AF_ATMSVC 00514 #ifdef HAVE_LINUX_ATM_H 00515 00516 static void 00517 explain_buffer_sockaddr_af_atmsvc(explain_string_buffer_t *sb, 00518 const struct sockaddr_atmsvc *sa, size_t sa_len) 00519 { 00520 explain_string_buffer_putc(sb, ','); 00521 /* FIXME: decode sockaddr_atmsvc */ 00522 if (sa_len > sizeof(*sa)) 00523 sa_len = sizeof(*sa); 00524 explain_buffer_hexdump(sb, sa, sa_len); 00525 } 00526 00527 #endif 00528 #endif 00529 00530 #ifdef AF_SNA 00531 00532 static void 00533 explain_buffer_sockaddr_af_sna(explain_string_buffer_t *sb, 00534 const struct sockaddr *sa, size_t sa_len) 00535 { 00536 explain_string_buffer_putc(sb, ','); 00537 /* FIXME: decode sockaddr_sna */ 00538 if (sa_len > sizeof(*sa)) 00539 sa_len = sizeof(*sa); 00540 explain_buffer_hexdump(sb, sa, sa_len); 00541 } 00542 00543 #endif 00544 00545 #ifdef AF_IRDA 00546 #ifdef HAVE_LINUX_IRDA_H 00547 00548 static void 00549 explain_buffer_sockaddr_af_irda(explain_string_buffer_t *sb, 00550 const struct sockaddr_irda *sa, size_t sa_len) 00551 { 00552 explain_string_buffer_putc(sb, ','); 00553 /* FIXME: decode sockaddr_irda */ 00554 if (sa_len > sizeof(*sa)) 00555 sa_len = sizeof(*sa); 00556 explain_buffer_hexdump(sb, sa, sa_len); 00557 } 00558 00559 #endif 00560 #endif 00561 00562 #ifdef AF_PPPOX 00563 #ifdef HAVE_LINUX_IF_PPPOX_H 00564 00565 static void 00566 explain_buffer_sockaddr_af_pppox(explain_string_buffer_t *sb, 00567 const struct sockaddr_pppox *sa, size_t sa_len) 00568 { 00569 explain_string_buffer_putc(sb, ','); 00570 /* FIXME: decode sockaddr_pppox */ 00571 if (sa_len > sizeof(*sa)) 00572 sa_len = sizeof(*sa); 00573 explain_buffer_hexdump(sb, sa, sa_len); 00574 /* file /usr/include/linux/if_pppox.h */ 00575 } 00576 00577 #endif 00578 #endif 00579 00580 #ifdef AF_WANPIPE 00581 00582 static void 00583 explain_buffer_sockaddr_af_wanpipe(explain_string_buffer_t *sb, 00584 const struct sockaddr *sa, size_t sa_len) 00585 { 00586 explain_string_buffer_putc(sb, ','); 00587 /* FIXME: decode sockaddr_wanpipe */ 00588 if (sa_len > sizeof(*sa)) 00589 sa_len = sizeof(*sa); 00590 explain_buffer_hexdump(sb, sa, sa_len); 00591 } 00592 00593 #endif 00594 00595 #ifdef AF_BLUETOOTH 00596 00597 static void 00598 explain_buffer_sockaddr_af_bluetooth(explain_string_buffer_t *sb, 00599 const struct sockaddr *sa, size_t sa_len) 00600 { 00601 explain_string_buffer_putc(sb, ','); 00602 /* FIXME: decode sockaddr_(something) */ 00603 if (sa_len > sizeof(*sa)) 00604 sa_len = sizeof(*sa); 00605 explain_buffer_hexdump(sb, sa, sa_len); 00606 00607 /* 00608 * file /usr/include/bluetooth/hci.h: struct sockaddr_hci 00609 * file /usr/include/bluetooth/l2cap.h: struct sockaddr_l2 00610 * file /usr/include/bluetooth/rfcomm.h: struct sockaddr_rc 00611 * file /usr/include/bluetooth/sco.h: struct sockaddr_sco 00612 */ 00613 } 00614 00615 #endif 00616 00617 #ifdef AF_IUCV 00618 #ifdef HAVE_NETIUCV_IUCV_H 00619 00620 static void 00621 explain_buffer_sockaddr_af_iucv(explain_string_buffer_t *sb, 00622 const struct sockaddr_iucv *sa, size_t sa_len) 00623 { 00624 explain_string_buffer_putc(sb, ','); 00625 /* FIXME: decode sockaddr_iucv */ 00626 if (sa_len > sizeof(*sa)) 00627 sa_len = sizeof(*sa); 00628 explain_buffer_hexdump(sb, sa, sa_len); 00629 } 00630 00631 #endif 00632 #endif 00633 00634 #ifdef AF_RXRPC 00635 00636 static void 00637 explain_buffer_sockaddr_af_rxrpc(explain_string_buffer_t *sb, 00638 const struct sockaddr *sa, size_t sa_len) 00639 { 00640 explain_string_buffer_putc(sb, ','); 00641 /* FIXME: decode sockaddr_rxrpc */ 00642 if (sa_len > sizeof(*sa)) 00643 sa_len = sizeof(*sa); 00644 explain_buffer_hexdump(sb, sa, sa_len); 00645 } 00646 00647 #endif 00648 00649 void 00650 explain_buffer_sockaddr(explain_string_buffer_t *sb, 00651 const struct sockaddr *sa, int sa_len) 00652 { 00653 if (explain_is_efault_pointer(sa, sizeof(*sa))) 00654 { 00655 explain_buffer_pointer(sb, sa); 00656 return; 00657 } 00658 explain_string_buffer_puts(sb, "{ sa_family = "); 00659 explain_buffer_address_family(sb, sa->sa_family); 00660 switch (sa->sa_family) 00661 { 00662 case AF_UNSPEC: 00663 break; 00664 00665 case AF_UNIX: 00666 explain_buffer_sockaddr_af_unix 00667 ( 00668 sb, 00669 (const struct sockaddr_un *)sa, 00670 sa_len 00671 ); 00672 break; 00673 00674 case AF_INET: 00675 explain_buffer_sockaddr_af_inet 00676 ( 00677 sb, 00678 (const struct sockaddr_in *)sa, 00679 sa_len 00680 ); 00681 break; 00682 00683 #ifdef AF_AX25 00684 #ifdef HAVE_LINUX_X25_H 00685 case AF_AX25: 00686 explain_buffer_sockaddr_af_ax25 00687 ( 00688 sb, 00689 (const struct sockaddr_ax25 *)sa, 00690 sa_len 00691 ); 00692 break; 00693 #endif 00694 #endif 00695 00696 #ifdef AF_IPX 00697 case AF_IPX: 00698 explain_buffer_sockaddr_af_ipx 00699 ( 00700 sb, 00701 (const struct sockaddr_ipx *)sa, 00702 sa_len 00703 ); 00704 break; 00705 #endif 00706 00707 #ifdef AF_APPLETALK 00708 case AF_APPLETALK: 00709 explain_buffer_sockaddr_af_appletalk 00710 ( 00711 sb, 00712 (const struct sockaddr_at *)sa, 00713 sa_len 00714 ); 00715 break; 00716 #endif 00717 00718 #ifdef AF_NETROM 00719 case AF_NETROM: 00720 explain_buffer_sockaddr_af_netrom(sb, sa, sa_len); 00721 break; 00722 #endif 00723 00724 #ifdef AF_BRIDGE 00725 case AF_BRIDGE: 00726 explain_buffer_sockaddr_af_bridge(sb, sa, sa_len); 00727 break; 00728 #endif 00729 00730 #ifdef AF_ATMPVC 00731 #ifdef HAVE_LINUX_ATM_H 00732 case AF_ATMPVC: 00733 explain_buffer_sockaddr_af_atmpvc 00734 ( 00735 sb, 00736 (const struct sockaddr_atmpvc *)sa, 00737 sa_len 00738 ); 00739 break; 00740 #endif 00741 #endif 00742 00743 #ifdef AF_X25 00744 #ifdef HAVE_LINUX_X25_H 00745 case AF_X25: 00746 explain_buffer_sockaddr_af_x25 00747 ( 00748 sb, 00749 (const struct sockaddr_x25 *)sa, 00750 sa_len 00751 ); 00752 break; 00753 #endif 00754 #endif 00755 00756 #ifdef AF_INET6 00757 case AF_INET6: 00758 explain_buffer_sockaddr_af_inet6 00759 ( 00760 sb, 00761 (const struct sockaddr_in6 *)sa, 00762 sa_len 00763 ); 00764 break; 00765 #endif 00766 00767 #ifdef AF_ROSE 00768 case AF_ROSE: 00769 explain_buffer_sockaddr_af_rose 00770 ( 00771 sb, 00772 (const struct sockaddr_rose *)sa, 00773 sa_len 00774 ); 00775 break; 00776 #endif 00777 00778 #ifdef AF_DECnet 00779 case AF_DECnet: 00780 explain_buffer_sockaddr_af_decnet(sb, sa, sa_len); 00781 break; 00782 #endif 00783 00784 #ifdef AF_NETBEUI 00785 case AF_NETBEUI: 00786 explain_buffer_sockaddr_af_netbeui(sb, sa, sa_len); 00787 break; 00788 #endif 00789 00790 #ifdef AF_SECURITY 00791 case AF_SECURITY: 00792 explain_buffer_sockaddr_af_security(sb, sa, sa_len); 00793 break; 00794 #endif 00795 00796 #ifdef AF_KEY 00797 case AF_KEY: 00798 explain_buffer_sockaddr_af_key(sb, sa, sa_len); 00799 break; 00800 #endif 00801 00802 #ifdef AF_NETLINK 00803 #ifdef HAVE_LINUX_NETLINK_H 00804 case AF_NETLINK: 00805 /* case AF_ROUTE: */ 00806 explain_buffer_sockaddr_af_netlink 00807 ( 00808 sb, 00809 (const struct sockaddr_nl *)sa, 00810 sa_len 00811 ); 00812 break; 00813 #endif 00814 #endif 00815 00816 #ifdef AF_PACKET 00817 case AF_PACKET: 00818 explain_buffer_sockaddr_af_packet 00819 ( 00820 sb, 00821 (const struct sockaddr_ll *)sa, 00822 sa_len 00823 ); 00824 break; 00825 #endif 00826 00827 #ifdef AF_ASH 00828 case AF_ASH: 00829 explain_buffer_sockaddr_af_ash 00830 ( 00831 sb, 00832 (const struct sockaddr_ash *)sa, 00833 sa_len 00834 ); 00835 break; 00836 #endif 00837 00838 #ifdef AF_ECONET 00839 case AF_ECONET: 00840 explain_buffer_sockaddr_af_econet 00841 ( 00842 sb, 00843 (const struct sockaddr_ec *)sa, 00844 sa_len 00845 ); 00846 break; 00847 #endif 00848 00849 #ifdef AF_ATMSVC 00850 #ifdef HAVE_LINUX_ATM_H 00851 case AF_ATMSVC: 00852 explain_buffer_sockaddr_af_atmsvc 00853 ( 00854 sb, 00855 (const struct sockaddr_atmsvc *)sa, 00856 sa_len 00857 ); 00858 break; 00859 #endif 00860 #endif 00861 00862 #ifdef AF_SNA 00863 case AF_SNA: 00864 explain_buffer_sockaddr_af_sna(sb, sa, sa_len); 00865 break; 00866 #endif 00867 00868 #ifdef AF_IRDA 00869 #ifdef HAVE_LINUX_IRDA_H 00870 case AF_IRDA: 00871 explain_buffer_sockaddr_af_irda 00872 ( 00873 sb, 00874 (const struct sockaddr_irda *)sa, 00875 sa_len 00876 ); 00877 break; 00878 #endif 00879 #endif 00880 00881 #ifdef AF_PPPOX 00882 #ifdef HAVE_LINUX_IF_PPPOX_H 00883 case AF_PPPOX: 00884 explain_buffer_sockaddr_af_pppox 00885 ( 00886 sb, 00887 (const struct sockaddr_pppox *)sa, 00888 sa_len 00889 ); 00890 break; 00891 #endif 00892 #endif 00893 00894 #ifdef AF_WANPIPE 00895 case AF_WANPIPE: 00896 explain_buffer_sockaddr_af_wanpipe(sb, sa, sa_len); 00897 break; 00898 #endif 00899 00900 #ifdef AF_BLUETOOTH 00901 case AF_BLUETOOTH: 00902 explain_buffer_sockaddr_af_bluetooth(sb, sa, sa_len); 00903 break; 00904 #endif 00905 00906 #ifdef AF_IUCV 00907 #ifdef HAVE_NETIUCV_IUCV_H 00908 case AF_IUCV: 00909 explain_buffer_sockaddr_af_iucv 00910 ( 00911 sb, 00912 (const struct sockaddr_iucv *)sa, 00913 sa_len 00914 ); 00915 break; 00916 #endif 00917 #endif 00918 00919 #ifdef AF_RXRPC 00920 case AF_RXRPC: 00921 explain_buffer_sockaddr_af_rxrpc(sb, sa, sa_len); 00922 break; 00923 #endif 00924 00925 default: 00926 /* no idea */ 00927 explain_string_buffer_putc(sb, ','); 00928 explain_buffer_hexdump(sb, sa, sa_len); 00929 break; 00930 } 00931 explain_string_buffer_puts(sb, " }"); 00932 } 00933 00934 00935 /* vim: set ts=8 sw=4 et : */