Grabbing A Value

I have this function and from this function I want to use the value of EOP in another part of the program int main(). How do I get or pass this value, I'm new and can't figure it out. Thank you.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
void decode_tcp(char *_packet)
{
    TCPHEADER *tcp_header = (TCPHEADER *)_packet;
    BYTE flags = ( ntohs(tcp_header->info_ctrl) & 0x003F );
	int EP;
	printf("\n   Source Port   : %ld", htons(tcp_header->source_port));
	printf("\n   Destination Port : %ld", htons(tcp_header->destination_port));
	printf("\n   Control Bits  : ");
 
	if ( flags & 0x01 ) // FIN
		printf( "FIN " );
	if ( flags & 0x02 ) // SYN
		printf( "SYN " );
	if ( flags & 0x04 ) // RST
		printf( "RST " );
	if ( flags & 0x08 ) // PSH
		printf( "PSH " );
	if ( flags & 0x10 ) // ACK
		printf( "ACK " );
	if ( flags & 0x20 ) // URG
		printf( "URG " );
	printf("\n   Sequence Number  : %lu", ntohl(tcp_header->seq_number));
		int EOP;
		if ( flags & 0x01 && flags & 0x10 )
		{
		printf("\n   End of Packet " );
		EOP = 1;
		}
		else
		{
		printf("\n   Not End of Packet " );
		EOP = 0;
		}
Last edited on

1
2
3
4
5
int someFunct(int passedvar)
{
     // look into functions in the documentation of this web site.
     return EOP
}


http://www.cplusplus.com/doc/

there are plenty of tutorials there for the basic stuff.
Topic archived. No new replies allowed.