/***************************************************************************
 *   Nipper - The network infrastructure parser                            *
 *   Copyright (C) 2006 - 2008 by Ian Ventura-Whiting (Fizz)               *
 *   fizz@titania.co.uk                                                    *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 3 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program. If not, see <http://www.gnu.org/licenses/>.  *
 ***************************************************************************/


struct sshPIXConfig
{
	int version;
	int timeout;
	char ipAddress[32];
	char netMask[32];
	char interface[32];
};


// Process fixup
void processPIXSSH(char *line, struct nipperConfig *nipper)
{
	// Variables...
	struct ciscoCommand command;

	// Debug
	if (nipper->debugMode == true)
	{
		printf("SSH Line: %s\n", line);
	}

	// If structure doesn't exist
	if (nipper->pix->ssh == 0)
	{
		nipper->pix->ssh = malloc(sizeof(struct sshPIXConfig));
		memset(nipper->pix->ssh, 0, sizeof(struct sshPIXConfig));
		nipper->pix->ssh->timeout = 5;
		strcpy(nipper->pix->ssh->interface, "Any except outside");
	}

	// Init
	command = splitLine(line);

	// Timeout
	if (strcmp(command.part[1], "timeout") == 0)
		nipper->pix->ssh->timeout = atoi(command.part[2]);

	// Version
	else if (strcmp(command.part[1], "version") == 0)
		nipper->pix->ssh->version = atoi(command.part[2]);

	// Management IP
	else if (command.parts == 4)
	{
		strncpy(nipper->pix->ssh->ipAddress, command.part[1], sizeof(nipper->pix->ssh->ipAddress) - 1);
		strncpy(nipper->pix->ssh->netMask, command.part[2], sizeof(nipper->pix->ssh->netMask) - 1);
		strncpy(nipper->pix->ssh->interface, command.part[3], sizeof(nipper->pix->ssh->interface) - 1);
	}
}

