Author: biurrun Date: Thu Nov 26 17:52:49 2009 New Revision: 1833 Log: Move print_msg_info() to common.c. Deleted: trunk/pairing/common_headers.c Modified: trunk/Makefile.am trunk/pairing/common.c trunk/pairing/common.h trunk/pairing/common_headers.h Modified: trunk/Makefile.am ============================================================================== --- trunk/Makefile.am Thu Nov 26 17:48:44 2009 (r1832) +++ trunk/Makefile.am Thu Nov 26 17:52:49 2009 (r1833) @@ -73,7 +73,6 @@ community-operator/hipl.c pairing_COMMON_SRCS = pairing/common.c \ - pairing/common_headers.c \ pairing/libconfig_wrapper.c pairing_ACCEPT_SEND_SRCS = $(pairing_COMMON_SRCS) \ Modified: trunk/pairing/common.c ============================================================================== --- trunk/pairing/common.c Thu Nov 26 17:48:44 2009 (r1832) +++ trunk/pairing/common.c Thu Nov 26 17:52:49 2009 (r1833) @@ -174,3 +174,40 @@ return 1; } + + +/** This message formats and prints out relevant message info (type, return value). + * + * @param msg_type An integer describing the message type + * @param return_value The return value from handle_packet() + */ +void print_msg_info(int msg_type, int return_value) +{ + char msg_string[100]; + + switch(msg_type) + { + case MSG_PASSWORD: + strcpy(msg_string, "password"); + break; + case MSG_ACK_1: + strcpy(msg_string, "ACK 1"); + break; + case MSG_PWD_REQUEST: + strcpy(msg_string, "password request"); + break; + case MSG_ACK_2: + strcpy(msg_string, "ACK 2"); + break; + case MSG_ERROR: + strcpy(msg_string, "error"); + break; + default: + strcpy(msg_string, "unknown"); + } + + DEBUG_MED("Message type: %s", msg_string); + DEBUG_MED("Return value: %d", return_value); + + return; +} Modified: trunk/pairing/common.h ============================================================================== --- trunk/pairing/common.h Thu Nov 26 17:48:44 2009 (r1832) +++ trunk/pairing/common.h Thu Nov 26 17:52:49 2009 (r1833) @@ -31,6 +31,7 @@ int valid_date_string(const char *expiration_date,struct tm *tm_expiration); int convert_time_t_to_formatted_string(time_t *time,char *buffer); int get_expiration_time(char *expiration_duration, long int *expiration_seconds); +void print_msg_info(int msg_type, int return_value); struct global_accept_variables { int socket_desc; Modified: trunk/pairing/common_headers.h ============================================================================== --- trunk/pairing/common_headers.h Thu Nov 26 17:48:44 2009 (r1832) +++ trunk/pairing/common_headers.h Thu Nov 26 17:52:49 2009 (r1833) @@ -80,8 +80,4 @@ } __attribute__ ((packed)) header_general; - -// Function prototypes -void print_msg_info(int msg_type, int return_value); - #endif /* PISA_COMMON_HEADERS_H */