/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*-  */
/*
 * socketcom.h
 * Copyright (C) 2014 Unknown <root@on6jc>
 *
 * socket_test 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.
 * 
 * socket_test 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/>.
 */

#ifndef _SOCKETCOM_H_
#define _SOCKETCOM_H_

typedef void (*netread_callback)(char *);

#include <gtk/gtk.h>

extern  GIOChannel *channel;

gboolean	network_read(GIOChannel *source, GIOCondition cond,
     			gpointer data);
gboolean	network_write_chars(GIOChannel *dest, char *message);
gboolean	new_connection(GSocketService *service,
			GSocketConnection *connection,
			GObject *source_object,
			gpointer user_data);
void		start_socket(const char *host, int port,
                netread_callback callback);
void		close_socket(int listenfd);

#endif // _SOCKETCOM_H_