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:
+11
-5
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
+6
-6
@@ -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);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
+2
-5
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user