Exemplo n.º 1
0
int
SOCK_get_id(SocketClass *self)
{
	int	id;

	if (!self)
		return 0;
	if (0 != self->errornumber)
		return 0;
	if (self->reslen > 0)
	{
		mylog("SOCK_get_id has to eat %d bytes\n", self->reslen);
		/*
		do
		{
			SOCK_get_next_byte(self, FALSE);
			if (0 != self->errornumber)
				return 0;
		} while (self->reslen > 0);
		*/
		SOCK_get_next_n_bytes(self, self->reslen, NULL);
	}
	id = SOCK_get_next_byte(self, FALSE);
	self->reslen = 0;
	return id;
}
Exemplo n.º 2
0
/*  bufsize must include room for the null terminator 
	will read at most bufsize-1 characters + null. 
*/
void 
SOCK_get_string(SocketClass *self, char *buffer, int bufsize)
{
register int lf = 0;

	for (lf = 0; lf < bufsize; lf++)
		if ( ! (buffer[lf] = SOCK_get_next_byte(self)))
			return;
		
	buffer[bufsize-1] = '\0';
}
Exemplo n.º 3
0
/*
 *	bufsize must include room for the null terminator
 *	will read at most bufsize-1 characters + null.
 *	returns TRUE if truncation occurs.
 */
BOOL
SOCK_get_string(SocketClass *self, char *buffer, Int4 bufsize)
{
	int lf;

	for (lf = 0; lf < bufsize - 1; lf++)
		if (!(buffer[lf] = SOCK_get_next_byte(self, FALSE)))
			return FALSE;

	buffer[bufsize - 1] = '\0';
	return TRUE;
}
Exemplo n.º 4
0
void 
SOCK_get_n_char(SocketClass *self, char *buffer, int len)
{
int lf;

	if ( ! buffer) {
		self->errornumber = SOCKET_NULLPOINTER_PARAMETER;
		self->errormsg = "get_n_char was called with NULL-Pointer";
		return;
	}

	for(lf=0; lf < len; lf++)
		buffer[lf] = SOCK_get_next_byte(self);
}
Exemplo n.º 5
0
void
SOCK_get_n_char(SocketClass *self, char *buffer, Int4 len)
{
	int			lf;

	if (!self)
		return;
	if (!buffer)
	{
		SOCK_set_error(self, SOCKET_NULLPOINTER_PARAMETER, "get_n_char was called with NULL-Pointer");
		return;
	}

	for (lf = 0; lf < len; lf++)
	{
		if (0 != self->errornumber)
			break;
		buffer[lf] = SOCK_get_next_byte(self, FALSE);
	}
}