Blame packet/command.h

Packit b802ec
/*
Packit b802ec
    mtr  --  a network diagnostic tool
Packit b802ec
    Copyright (C) 2016  Matt Kimball
Packit b802ec
Packit b802ec
    This program is free software; you can redistribute it and/or modify
Packit b802ec
    it under the terms of the GNU General Public License version 2 as
Packit b802ec
    published by the Free Software Foundation.
Packit b802ec
Packit b802ec
    This program is distributed in the hope that it will be useful,
Packit b802ec
    but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit b802ec
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit b802ec
    GNU General Public License for more details.
Packit b802ec
Packit b802ec
    You should have received a copy of the GNU General Public License
Packit b802ec
    along with this program; if not, write to the Free Software
Packit b802ec
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Packit b802ec
*/
Packit b802ec
Packit b802ec
#ifndef COMMAND_H
Packit b802ec
#define COMMAND_H
Packit b802ec
Packit b802ec
#include "platform.h"
Packit b802ec
#include "probe.h"
Packit b802ec
Packit b802ec
#define COMMAND_BUFFER_SIZE 4096
Packit b802ec
Packit b802ec
#ifdef PLATFORM_CYGWIN
Packit b802ec
#include "command_cygwin.h"
Packit b802ec
#else
Packit b802ec
#include "command_unix.h"
Packit b802ec
#endif
Packit b802ec
Packit b802ec
/*  Storage for incoming commands, prior to command parsing  */
Packit b802ec
struct command_buffer_t {
Packit b802ec
    /*  The file descriptor of the incoming command stream  */
Packit b802ec
    int command_stream;
Packit b802ec
Packit b802ec
    /*  Storage to read commands into  */
Packit b802ec
    char incoming_buffer[COMMAND_BUFFER_SIZE];
Packit b802ec
Packit b802ec
    /*  The number of bytes read so far in incoming_buffer  */
Packit b802ec
    int incoming_read_position;
Packit b802ec
Packit b802ec
    /*  Platform specific  */
Packit b802ec
    struct command_buffer_platform_t platform;
Packit b802ec
};
Packit b802ec
Packit b802ec
void init_command_buffer(
Packit b802ec
    struct command_buffer_t *command_buffer,
Packit b802ec
    int command_stream);
Packit b802ec
Packit b802ec
int read_commands(
Packit b802ec
    struct command_buffer_t *buffer);
Packit b802ec
Packit b802ec
void dispatch_buffer_commands(
Packit b802ec
    struct command_buffer_t *buffer,
Packit b802ec
    struct net_state_t *net_state);
Packit b802ec
Packit b802ec
#endif