Esempio n. 1
0
int tcp_construct(tcp_sock_t *tcp)
{
	ASSERT(tcp);

	DO(ip_construct(&tcp->ip));

	/* Reset its part of the struct (skip IP part) */
	memset(((char *)tcp + sizeof(tcp->ip)), 0, sizeof(*tcp) - sizeof(tcp->ip));
	tcp->initialized = 0;

	return 0;
}
Esempio n. 2
0
/* basic resource allocations for the tcp object */
int tcp_construct(tcp_sock_t *p_self)
{
	int rc;

	if (p_self == NULL) {
		return RC_INVALID_POINTER;
	}

	rc = ip_construct(&p_self->super);
	if (rc != 0) {
		return rc;
	}

	/*reset its part of the struct (skip IP part) */
	memset(((char *)p_self + sizeof(p_self->super)), 0, sizeof(*p_self) - sizeof(p_self->super));
	p_self->initialized = 0;

	return 0;
}