Remove libipm_msg_in_start()
The semantics of this call allowed it to be called more than once when parsing a message to restart a parse. This is not likely to be useful in practice, and it also makes reading file descriptors more complicated. Consequently this function has been removed and replaced with with libipm_msg_in_get_msgno()
This commit is contained in:
parent
2c6419475c
commit
02a3821f4d
@ -219,6 +219,12 @@ libipm_msg_out_erase(struct trans *trans);
|
||||
* @param trans libipm transport
|
||||
* @param[out] available != 0 if a complete message is available
|
||||
* @return != 0 for error
|
||||
*
|
||||
* When 'available' becomes set, the buffer is guaranteed to
|
||||
* be in a parseable state.
|
||||
*
|
||||
* The results of calling this function after starting to parse a message
|
||||
* and before calling libipm_msg_in_reset() are undefined.
|
||||
*/
|
||||
enum libipm_status
|
||||
libipm_msg_in_check_available(struct trans *trans, int *available);
|
||||
@ -233,6 +239,9 @@ libipm_msg_in_check_available(struct trans *trans, int *available);
|
||||
* While the call is active, data-in callbacks for the transport are
|
||||
* disabled.
|
||||
*
|
||||
* The results of calling this function after starting to parse a message
|
||||
* and before calling libipm_msg_in_reset() are undefined.
|
||||
*
|
||||
* Only use this call if you have nothing to do until a message
|
||||
* arrives on the transport. If you have other transports to service, use
|
||||
* libipm_msg_in_check_available()
|
||||
@ -241,7 +250,7 @@ enum libipm_status
|
||||
libipm_msg_in_wait_available(struct trans *trans);
|
||||
|
||||
/**
|
||||
* Start parsing a message
|
||||
* Get the message number for a message in the input buffer.
|
||||
*
|
||||
* @param trans libipm transport
|
||||
* @return message number in the buffer
|
||||
@ -250,12 +259,9 @@ libipm_msg_in_wait_available(struct trans *trans);
|
||||
* libipm_msg_in_reset() and before a successful call to
|
||||
* libipm_msg_in_check_available() (or libipm_msg_wait_available())
|
||||
* are undefined.
|
||||
*
|
||||
* Calling this function resets the message parsing pointer to the start
|
||||
* of the message
|
||||
*/
|
||||
unsigned short
|
||||
libipm_msg_in_start(struct trans *trans);
|
||||
libipm_msg_in_get_msgno(const struct trans *trans);
|
||||
|
||||
/**
|
||||
* Returns a letter corresponding to the next available type in the
|
||||
|
@ -187,11 +187,10 @@ libipm_msg_in_wait_available(struct trans *trans)
|
||||
/*****************************************************************************/
|
||||
|
||||
unsigned short
|
||||
libipm_msg_in_start(struct trans *trans)
|
||||
libipm_msg_in_get_msgno(const struct trans *trans)
|
||||
{
|
||||
struct libipm_priv *priv = (struct libipm_priv *)trans->extra_data;
|
||||
|
||||
trans->in_s->p = trans->in_s->data + HEADER_SIZE;
|
||||
return (priv == NULL) ? 0 : priv->in_msgno;
|
||||
}
|
||||
|
||||
|
12
libipm/scp.c
12
libipm/scp.c
@ -212,18 +212,18 @@ scp_msg_in_wait_available(struct trans *trans)
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
void
|
||||
scp_msg_in_reset(struct trans *trans)
|
||||
enum scp_msg_code
|
||||
scp_msg_in_get_msgno(const struct trans *trans)
|
||||
{
|
||||
libipm_msg_in_reset(trans);
|
||||
return (enum scp_msg_code)libipm_msg_in_get_msgno(trans);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
enum scp_msg_code
|
||||
scp_msg_in_start(struct trans *trans)
|
||||
void
|
||||
scp_msg_in_reset(struct trans *trans)
|
||||
{
|
||||
return (enum scp_msg_code)libipm_msg_in_start(trans);
|
||||
libipm_msg_in_reset(trans);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -164,19 +164,16 @@ scp_msg_in_wait_available(struct trans *trans);
|
||||
|
||||
|
||||
/**
|
||||
* Start parsing an SCP message
|
||||
* Gets the SCP message number of an incoming message
|
||||
*
|
||||
* @param trans SCP transport
|
||||
* @return message in the buffer
|
||||
*
|
||||
* The results of calling this routine before scp_msg_in_check_available()
|
||||
* states a message is available are undefined.
|
||||
*
|
||||
* Calling this function rests the message parsing pointer to the start
|
||||
* of the message
|
||||
*/
|
||||
enum scp_msg_code
|
||||
scp_msg_in_start(struct trans *trans);
|
||||
scp_msg_in_get_msgno(const struct trans *trans);
|
||||
|
||||
/**
|
||||
* Resets an SCP message buffer ready to receive the next message
|
||||
|
@ -536,7 +536,7 @@ scp_process(struct sesman_con *sc)
|
||||
enum scp_msg_code msgno;
|
||||
int rv = 0;
|
||||
|
||||
switch ((msgno = scp_msg_in_start(sc->t)))
|
||||
switch ((msgno = scp_msg_in_get_msgno(sc->t)))
|
||||
{
|
||||
case E_SCP_SET_PEERNAME_REQUEST:
|
||||
rv = process_set_peername_request(sc);
|
||||
|
@ -50,7 +50,7 @@ wait_for_sesman_reply(struct trans *t, enum scp_msg_code wait_msgno)
|
||||
}
|
||||
else
|
||||
{
|
||||
enum scp_msg_code reply_msgno = scp_msg_in_start(t);
|
||||
enum scp_msg_code reply_msgno = scp_msg_in_get_msgno(t);
|
||||
|
||||
available = 1;
|
||||
if (reply_msgno != wait_msgno)
|
||||
|
@ -116,7 +116,7 @@ check_for_incoming_message(unsigned short expected_msgno)
|
||||
status = libipm_msg_in_wait_available(g_t_in);
|
||||
ck_assert_int_eq(status, E_LI_SUCCESS);
|
||||
|
||||
msgno = libipm_msg_in_start(g_t_in);
|
||||
msgno = libipm_msg_in_get_msgno(g_t_in);
|
||||
ck_assert_int_eq(msgno, expected_msgno);
|
||||
}
|
||||
|
||||
|
@ -2145,7 +2145,7 @@ xrdp_mm_scp_data_in(struct trans *trans)
|
||||
struct xrdp_mm *self = (struct xrdp_mm *)(trans->callback_data);
|
||||
enum scp_msg_code msgno;
|
||||
|
||||
switch ((msgno = scp_msg_in_start(trans)))
|
||||
switch ((msgno = scp_msg_in_get_msgno(trans)))
|
||||
{
|
||||
case E_SCP_LOGIN_RESPONSE:
|
||||
rv = xrdp_mm_process_login_response(self);
|
||||
|
Loading…
Reference in New Issue
Block a user