R
Roman Mashak
Hello,
I belive the reason of problem is simple, but can't figure out.
This is piece of code:
struct timeval {
long tv_sec; /* seconds */
long tv_usec; /* microseconds */
};
extern void proc_v4(char *, ssize_t, struct timeval *);
....
int main(void)
{
static char recvbuf[BUFSIZE];
ssize_t n;
struct timeval tv2;
...
proc_v4(recvbuf, n, &tv2);
}
void proc_v4(char *ptr, ssize_t len, struct timeval *tvsend)
{
struct icmp *icmp;
...
/* here I parse IP packet and address pointer on ICMP packet */
...
tvsend = (struct timeval *) icmp->icmp_data;
}
The problem is after calling proc_v4() the value of 'tv2' doesn't change,
what I can't understand, because I pass pointer, and then re-assign pointer
into another one.
Where is the problem? Thanks a lot.
With best regards, Roman Mashak. E-mail: (e-mail address removed)
I belive the reason of problem is simple, but can't figure out.
This is piece of code:
struct timeval {
long tv_sec; /* seconds */
long tv_usec; /* microseconds */
};
extern void proc_v4(char *, ssize_t, struct timeval *);
....
int main(void)
{
static char recvbuf[BUFSIZE];
ssize_t n;
struct timeval tv2;
...
proc_v4(recvbuf, n, &tv2);
}
void proc_v4(char *ptr, ssize_t len, struct timeval *tvsend)
{
struct icmp *icmp;
...
/* here I parse IP packet and address pointer on ICMP packet */
...
tvsend = (struct timeval *) icmp->icmp_data;
}
The problem is after calling proc_v4() the value of 'tv2' doesn't change,
what I can't understand, because I pass pointer, and then re-assign pointer
into another one.
Where is the problem? Thanks a lot.
With best regards, Roman Mashak. E-mail: (e-mail address removed)