common.h File Reference

#include <sstream>
#include <string>
#include "RioInterface.h"

Go to the source code of this file.

Defines

#define DEFAULTBUFFERSIZE   2
#define DEFAULTUSER   "guest"
#define RIORC_RIOMMCLIENT_VERSION   "1.2"
#define RIORC_RIOMMVIDEO_VERSION   "1.0"
#define RIORC_RIOMMBROWSER_VERSION   "1.0"
#define RIORC_RIOMMTGIF_VERSION   "1.0"
#define RIORC_RIOSH_VERSION   "1.0"

Functions

char * encryptPassword (const char *)
char * randomName (void)
string float2string (float)
string int2string (int)
string short2Permission (short)

Define Documentation

#define DEFAULTBUFFERSIZE   2

Definition at line 21 of file common.h.

#define DEFAULTUSER   "guest"

Definition at line 22 of file common.h.

#define RIORC_RIOMMBROWSER_VERSION   "1.0"

Definition at line 25 of file common.h.

#define RIORC_RIOMMCLIENT_VERSION   "1.2"

Definition at line 23 of file common.h.

#define RIORC_RIOMMTGIF_VERSION   "1.0"

Definition at line 26 of file common.h.

#define RIORC_RIOMMVIDEO_VERSION   "1.0"

Definition at line 24 of file common.h.

#define RIORC_RIOSH_VERSION   "1.0"

Definition at line 27 of file common.h.


Function Documentation

char* encryptPassword ( const char *   ) 

Definition at line 113 of file common.cpp.

00114 {
00115     char * pass;
00116 
00117     try
00118     {
00119         pass = (char *) malloc( strlen( pwd ) + 1 );
00120 
00121         sprintf( pass, "%s" , pwd );
00122         for( unsigned int i = 0; i < strlen( pass ); i++ )
00123             pass[ i ] = ((pass[ i ] & 0x0F) << 4) | ((pass[ i ] & 0xF0) >> 4);
00124 
00125         return pass;
00126     }
00127     catch( bad_alloc &ba )
00128     {
00129         return NULL;
00130     }
00131 }

string float2string ( float   ) 

Definition at line 133 of file common.cpp.

00134 {
00135     ostringstream os;
00136     os << f;
00137 
00138     return os.str();
00139 }

string int2string ( int   ) 

Definition at line 141 of file common.cpp.

00142 {
00143     ostringstream os;
00144     os << i;
00145 
00146     return os.str();
00147 }

char* randomName ( void   ) 
string short2Permission ( short   ) 

Definition at line 149 of file common.cpp.

00150 {
00151     string permission;
00152     const char *p = "rwxrwxrwx";
00153 
00154     for( int j = 0x100; *p != '\0'; p++ )
00155     {
00156         if( j & perm )
00157             permission += *p;
00158         else
00159             permission += "-";
00160         j >>= 1;
00161     }
00162 
00163     return permission;
00164 }

Generated on Wed Jul 4 16:03:29 2012 for RIO by  doxygen 1.6.3