Hi there,
This is my code
Code:
int SRV_TYPE=0;
const int HTTP=80;
const int FTP=21;
const int TELNET=23;
const int POP3=110;
const int SMTP=25;
..
.
.
.
SRV_TYPE= (int)DST_PORT;
switch (SRV_TYPE)
{ case HTTP: printf("HTTP Data ..... \n");
print_data(tcp_ptr,length);
break;
case FTP: printf("FTP Data .....\n");
print_data(tcp_ptr,length);
break;
case TELNET: printf("TELNET Data ....\n");
print_data(tcp_ptr,length);
break;
case POP3: printf("POP3 Data ....\n");
print_data(tcp_ptr,length);
break;
case SMTP: printf("SMTP Data ....\n");
print_data(tcp_ptr,length);
break;
default : printf("Unknown Data Type\n");
break;
}
When i compile it on FreeBSD, I get this error msg :
Code:
In function `print_tcp_seg':
463: case label does not reduce to an integer constant
467: case label does not reduce to an integer constant
471: case label does not reduce to an integer constant
475: case label does not reduce to an integer constant
479: case label does not reduce to an integer constant
463: warning: unreachable code at beginning of switch statement
*** Error code 1
It seems the problem with the SWITCH statement, I am gessing that there is a mismatch between SRV_TYPE (int) and DST_PORT (u_short), am I right ?
SRV_TYPE=(int) DST_PORT; CAN I DO THAT ????
Any suggestion ?
any tiny help is very highly appreciated.
AHT