src/SAL_network.h

00001 /*
00002     SAL - Simple Application Library
00003     Copyright (C) 2006-2006 Kronon
00004 
00005     This library is free software; you can redistribute it and/or
00006     modify it under the terms of the GNU Lesser General Public
00007     License as published by the Free Software Foundation; either
00008     version 2.1 of the License, or (at your option) any later version.
00009 
00010     This library is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013     Lesser General Public License for more details.
00014 
00015     You should have received a copy of the GNU Lesser General Public
00016     License along with this library; if not, write to the Free Software
00017     Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00018 
00019     Kronon
00020     kronon88@users.sourceforge.net
00021 */
00022 
00023 //SAL network functionality
00024 //Created by Kronon
00025  
00026 #ifndef SAL_NETWORK_LISTENER_H
00027 #define SAL_NETWORK_LISTENER_H
00028 
00029 //Library's
00030 
00031 #include "SAL.h"
00032 
00033 #define SAL_MAX_PACKET_SIZE 1024
00034 
00035 //Start the SAL network utilities
00036 int SAL_start_network();
00037 //Stop the SAL network utilities
00038 int SAL_stop_network();
00039 
00040 //Add an input socket to one of the network listeners
00041 int addUdpInputSocket(Uint16 portNr);
00042 //Init an output socket and add it to the output socket list
00043 int addUdpOutputSocket(Uint16 portNr);
00044 
00045 //Catches network events and call's network listeners
00046 int SAL_network_listener_thread(void * unused);
00047 //Send udp message
00048 int sendUdpMessage(const char* message, Uint16 mesLen, IPaddress *adresses, Uint8 numIp = 0, UDPsocket socket = SAL_struct.internal.event.socketsOut[0]);
00049 
00050 //Set message handler
00051 int salSetNetworkHhandler(int (*network_handler)(char *message, IPaddress *address));
00052 
00053 #endif