Home
FAQ
Player
Stage
Gazebo
Contrib
Documentation
Publications
Contributors
Users

Project
Download
Bugs/Feedback
Mailing lists

Radish

Old news
Old stuff

packet.h

Go to the documentation of this file.
00001 /*
00002  *  Player - One Hell of a Robot Server
00003  *  Copyright (C) 2000  
00004  *     Brian Gerkey, Kasper Stoy, Richard Vaughan, & Andrew Howard
00005  *                      
00006  *
00007  *  This program is free software; you can redistribute it and/or modify
00008  *  it under the terms of the GNU General Public License as published by
00009  *  the Free Software Foundation; either version 2 of the License, or
00010  *  (at your option) any later version.
00011  *
00012  *  This program is distributed in the hope that it will be useful,
00013  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  *  GNU General Public License for more details.
00016  *
00017  *  You should have received a copy of the GNU General Public License
00018  *  along with this program; if not, write to the Free Software
00019  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00020  *
00021  */
00022 
00023 /*
00024  * $Id: packet.h,v 1.1 2002/11/29 17:07:43 gerkey Exp $
00025  *   part of the P2OS parser.  this class has methods for building,
00026  *   printing, sending and receiving P2OS packets.
00027  *
00028  */
00029 
00030 #ifndef _PACKET_H
00031 #define _PACKET_H
00032 
00033 #include <string.h>
00034 
00035 #define PACKET_LEN 256
00036 
00037 class P2OSPacket 
00038 {
00039  public:
00040   unsigned char packet[PACKET_LEN];
00041   unsigned char size;
00042 
00043   int CalcChkSum();
00044 
00045   void Print();
00046   void PrintHex();
00047   int Build( unsigned char *data, unsigned char datasize );
00048   int Send( int fd );
00049   int Receive( int fd );
00050   bool Check();
00051   
00052   bool operator!= ( P2OSPacket p ) {
00053     if ( size != p.size) return(true);
00054 
00055     if ( memcmp( packet, p.packet, size ) != 0 ) return (true);
00056 
00057     return(false);
00058   }
00059 };
00060 
00061 #endif

Generated on Tue May 3 14:15:35 2005 for Player by doxygen 1.3.6