agent-filter: Use enum as return value

Explicitely discard AGENT_MSG_FILTER_MONITORS_CONFIG messages
from the agent.

Also remove unused AGENT_MSG_FILTER_END

Acked-by: Frediano Ziglio <fziglio@redhat.com>
This commit is contained in:
Pavel Grunt 2016-09-16 12:32:23 +02:00 committed by Frediano Ziglio
parent 80b1e816c6
commit cd80b9fc78
3 changed files with 11 additions and 10 deletions

View File

@ -48,8 +48,8 @@ void agent_msg_filter_init(AgentMsgFilter *filter,
filter->discard_all = discard_all;
}
int agent_msg_filter_process_data(AgentMsgFilter *filter,
const uint8_t *data, uint32_t len)
AgentMsgFilterResult agent_msg_filter_process_data(AgentMsgFilter *filter,
const uint8_t *data, uint32_t len)
{
struct VDAgentMessage msg_header;

View File

@ -25,17 +25,16 @@
#include <glib.h>
/* Possible return values for agent_msg_filter_process_data */
enum {
typedef enum {
AGENT_MSG_FILTER_OK,
AGENT_MSG_FILTER_DISCARD,
AGENT_MSG_FILTER_PROTO_ERROR,
AGENT_MSG_FILTER_MONITORS_CONFIG,
AGENT_MSG_FILTER_END
};
} AgentMsgFilterResult;
typedef struct AgentMsgFilter {
int msg_data_to_read;
int result;
AgentMsgFilterResult result;
gboolean copy_paste_enabled;
gboolean file_xfer_enabled;
gboolean use_client_monitors_config;
@ -49,7 +48,7 @@ void agent_msg_filter_init(AgentMsgFilter *filter,
void agent_msg_filter_config(AgentMsgFilter *filter,
gboolean copy_paste, gboolean file_xfer,
gboolean use_client_monitors_config);
int agent_msg_filter_process_data(AgentMsgFilter *filter,
const uint8_t *data, uint32_t len);
AgentMsgFilterResult agent_msg_filter_process_data(AgentMsgFilter *filter,
const uint8_t *data, uint32_t len);
#endif

View File

@ -767,7 +767,7 @@ static void vdi_port_read_buf_release(uint8_t *data, void *opaque)
static gboolean vdi_port_read_buf_process(RedCharDeviceVDIPort *dev,
RedVDIReadBuf *buf, gboolean *error)
{
int res;
AgentMsgFilterResult res;
*error = FALSE;
@ -778,6 +778,8 @@ static gboolean vdi_port_read_buf_process(RedCharDeviceVDIPort *dev,
switch (res) {
case AGENT_MSG_FILTER_OK:
return TRUE;
case AGENT_MSG_FILTER_MONITORS_CONFIG:
/* fall through */
case AGENT_MSG_FILTER_DISCARD:
return FALSE;
case AGENT_MSG_FILTER_PROTO_ERROR:
@ -1199,7 +1201,7 @@ void reds_on_main_agent_data(RedsState *reds, MainChannelClient *mcc, void *mess
{
RedCharDeviceVDIPort *dev = reds->agent_dev;
VDIChunkHeader *header;
int res;
AgentMsgFilterResult res;
res = agent_msg_filter_process_data(&reds->agent_dev->priv->write_filter,
message, size);