Hi there,
I'm trying to initialize a two dimensional array (that hold structures) by making a certain field "on" equal to 0.
CODE
typedef struct packet_info {
int on;
u_char src_ip; /* source ip address */
u_short dst_port; /* destination port address */
u_char flag;
#define TH_FIN 0x01
#define TH_SYN 0x02
#define TH_RST 0x04
#define TH_PUSH 0x08
#define TH_ACK 0x10
#define TH_URG 0x20
#define TH_ECE 0x40
#define TH_CWR 0x80
#define TH_FLAGS (TH_FIN|TH_SYN|TH_RST|TH_ACK|TH_URG|TH_ECE|TH_CWR)
}Packet_Info;
CODE
int main(int argc, char **argv)
{
int i,j;
char *dev = NULL; /* capture device name */
char errbuf[PCAP_ERRBUF_SIZE]; /* error buffer */
pcap_t *handle; /* packet capture handle */
char filter_exp[] = ""; /* filter expression [3] */
struct bpf_program fp; /* compiled filter program (expression) */
bpf_u_int32 mask; /* subnet mask */
bpf_u_int32 net; /* ip */
int num_packets = 20; /* number of packets to capture */
Packet_Info array[10][10];
for(i=0;i<10;i++)
for(j=0;j<10;j++)
(array[j][i])->on = 0;
for(i=0;i<10;i++)
for(j=0;j<10;j++){
printf("source %d packet %d ip field is %d\n", i+1, j+1,array[j][i]->on);
getchar();
}
....
However i'm getting this error:
invalid type argument of '->'
Any ideas?
Also, how can I initialize the values of "src_ip", and "dst_port" to a certain value as I am not very familiar with the types: 'uchar' and 'u_short' ??
Thanks