/* orxonox - the future of 3D-vertical-scrollers Copyright (C) 2004 orx 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 2, or (at your option) any later version. ### File Specific: main-programmer: Christoph Renner co-programmer: ... */ //#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_ #include "udp_broadcast.h" /** * standard constructor * @todo this constructor is not jet implemented - do it */ UdpBroadcast::UdpBroadcast () { this->port = 0; packet = SDLNet_AllocPacket( BROADCAST_PACKET_SIZE ); if ( !packet ) { printf( "SDLNet_AllocPacket: %s\n", SDLNet_GetError() ); assert( packet ); } this->socket = NULL; } /** * standard deconstructor */ UdpBroadcast::~UdpBroadcast () { if ( this->packet ) { SDLNet_FreePacket( this->packet ); this->packet = NULL; } if ( this->socket ) { SDLNet_UDP_Close( this->socket ); this->socket = NULL; } } /** * listen for incoming broadcast packets * @param port port to listen on * @return true on success */ bool UdpBroadcast::listen( int port ) { return true; } /** * prepare for sending broadcast packets to port * @param port port to send to * @return true on success */ bool UdpBroadcast::open( int port ) { this->port = port; return true; } /** * send packet * @param data data to send * @param length length of data * @param ip if ip == NULL broadcast is used * @return number of bytes sent */ int UdpBroadcast::send( byte * data, int length, IPaddress * ip ) { return 0; } /** * recieve packets * @param data pointer to buffer to copy data to * @param maxLength maxmal number of bytes to copy to data * @param ip if != 0 ip contains data about sender * @return number of bytes recieved */ int UdpBroadcast::recv( byte * data, int maxLength, IPaddress * ip ) { return 0; }