Changeset c6588ce in mainline for uspace/app/netecho/print_error.c


Ignore:
Timestamp:
2012-05-05T08:12:17Z (12 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
ee04c28
Parents:
2cc7f16 (diff), d21e935c (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline changes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/netecho/print_error.c

    r2cc7f16 rc6588ce  
    4040#include <errno.h>
    4141
    42 #include <net/icmp_codes.h>
    43 
    44 /** Prints the specific ICMP error description.
    45  *
    46  * @param[in] output The description output stream. May be NULL.
    47  * @param[in] error_code The ICMP error code.
    48  * @param[in] prefix The error description prefix. May be NULL.
    49  * @param[in] suffix The error description suffix. May be NULL.
    50  */
    51 void icmp_print_error(FILE *output, int error_code, const char *prefix, const char *suffix)
    52 {
    53         if (!output)
    54                 return;
    55        
    56         if (prefix)
    57                 fprintf(output, "%s", prefix);
    58                
    59         switch (error_code) {
    60         case ICMP_DEST_UNREACH:
    61                 fprintf(output, "ICMP Destination Unreachable (%d) error", error_code);
    62                 break;
    63         case ICMP_SOURCE_QUENCH:
    64                 fprintf(output, "ICMP Source Quench (%d) error", error_code);
    65                 break;
    66         case ICMP_REDIRECT:
    67                 fprintf(output, "ICMP Redirect (%d) error", error_code);
    68                 break;
    69         case ICMP_ALTERNATE_ADDR:
    70                 fprintf(output, "ICMP Alternate Host Address (%d) error", error_code);
    71                 break;
    72         case ICMP_ROUTER_ADV:
    73                 fprintf(output, "ICMP Router Advertisement (%d) error", error_code);
    74                 break;
    75         case ICMP_ROUTER_SOL:
    76                 fprintf(output, "ICMP Router Solicitation (%d) error", error_code);
    77                 break;
    78         case ICMP_TIME_EXCEEDED:
    79                 fprintf(output, "ICMP Time Exceeded (%d) error", error_code);
    80                 break;
    81         case ICMP_PARAMETERPROB:
    82                 fprintf(output, "ICMP Paramenter Problem (%d) error", error_code);
    83                 break;
    84         case ICMP_CONVERSION_ERROR:
    85                 fprintf(output, "ICMP Datagram Conversion Error (%d) error", error_code);
    86                 break;
    87         case ICMP_REDIRECT_MOBILE:
    88                 fprintf(output, "ICMP Mobile Host Redirect (%d) error", error_code);
    89                 break;
    90         case ICMP_SKIP:
    91                 fprintf(output, "ICMP SKIP (%d) error", error_code);
    92                 break;
    93         case ICMP_PHOTURIS:
    94                 fprintf(output, "ICMP Photuris (%d) error", error_code);
    95                 break;
    96         default:
    97                 fprintf(output, "Other (%d) error", error_code);
    98         }
    99 
    100         if (suffix)
    101                 fprintf(output, "%s", suffix);
    102 }
    103 
    10442/** Prints the error description.
    10543 *
    106  * Supports ICMP and socket error codes.
     44 * Supports socket error codes.
    10745 *
    10846 * @param[in] output The description output stream. May be NULL.
     
    11351void print_error(FILE *output, int error_code, const char *prefix, const char *suffix)
    11452{
    115         if (IS_ICMP_ERROR(error_code))
    116                 icmp_print_error(output, error_code, prefix, suffix);
    117         else if(IS_SOCKET_ERROR(error_code))
     53        if(IS_SOCKET_ERROR(error_code))
    11854                socket_print_error(output, error_code, prefix, suffix);
    11955}
Note: See TracChangeset for help on using the changeset viewer.