void msgNewChapter( NetMessage *msg, const char *title, double startTime, double duration, BOOL absolute ) { MSGINIT( msg, NewChapter, Command ); strncpy( msg->data.URN, title, sizeof(msg->data.URN) ); msg->data.URN[sizeof(msg->data.URN)-1] = '\0'; msg->data.iVal1 = -999; msg->data.val1 = startTime; msg->data.val2 = duration; msg->data.boolean = absolute; }
void SendNetErrorNotification( SOCK ss, const char *txt, ErrCode err ) { NetMessage msg; if( ss != NULLSOCKET ){ MSGINIT( (&msg), Err, Notification ); if( *txt ){ strncpy( msg.data.URN, txt, sizeof(msg.data.URN) ); msg.data.URN[sizeof(msg.data.URN)-1] = '\0'; } msg.data.error = err; SendMessageToNet( ss, &msg, SENDTIMEOUT, FALSE, "SendNetErrorNotification" ); } }
void msgGetChapter( NetMessage *msg, int32_t idx ) { MSGINIT( msg, GetChapter, Command ); if( idx < 0 ){ strcpy( msg->data.URN, "<list all>" ); } else{ strcpy( msg->data.URN, "<in retrieval>" ); } msg->data.iVal1 = idx; set_NaN(msg->data.val1); set_NaN(msg->data.val2); msg->data.boolean = FALSE; }
void msgGetLastInterval(NetMessage *msg) { MSGINIT( msg, GetLastInterval, Command ); }
void msgMarkIntervalTime( NetMessage *msg, BOOL reset ) { MSGINIT( msg, MarkIntervalTime, Command ); msg->data.boolean = reset; }
void msgGetStartTime(NetMessage *msg) { MSGINIT( msg, GetStartTime, Command ); }
void msgGetDuration(NetMessage *msg) { MSGINIT( msg, GetDuration, Command ); }
void msgGetTime( NetMessage *msg, BOOL absolute ) { MSGINIT( msg, GetTime, Command ); msg->data.boolean = absolute; }
void msgGetTimeSubscription( NetMessage *msg, double interval, BOOL absolute ) { MSGINIT( msg, GetTimeSubscription, Command ); msg->data.val1 = interval; msg->data.boolean = absolute; }
void msgQuitQTVOD(NetMessage *msg) { MSGINIT( msg, Quit, Command ); }
void msgGotoTime( NetMessage *msg, double t, BOOL absolute ) { MSGINIT( msg, GotoTime, Command ); msg->data.val1 = t; msg->data.boolean = absolute; }
void msgResetQTVOD( NetMessage *msg, BOOL complete ) { MSGINIT( msg, Reset, Command ); msg->data.boolean = complete; }
void msgCloseMovie(NetMessage *msg) { MSGINIT( msg, Close, Command ); }
void msgStopMovie(NetMessage *msg) { MSGINIT( msg, Stop, Command ); }
void msgPlayMovie(NetMessage *msg) { MSGINIT( msg, Start, Command ); }
int main( int ac, char* av[] ) { int j; int Ret; char *pCell, *pPath, *pRas; int Fd; int Len; if( ac < 4 ) { usage(); exit( -1 ); } pCell = av[1]; j = atoi( av[2] ); pRas = av[3]; pPath = av[4]; Fd = ConnectAdmPort( pCell, j ); if( Fd < 0 ) { printf("No AdmPort[%s_%d]\n", pCell, j ); goto err; } /* * send RAS command */ PaxosSessionHead_t Any; MSGINIT( &Any, PAXOS_SESSION_ANY, 0, sizeof(Any)+sizeof(PFSRASReq_t)); Ret = SendStream( Fd, (char*)&Any, sizeof(Any) ); if( Ret ) { printf("ERR:SendStream[%s_%d] ANY\n", pCell, j ); goto err1; } PFSRASReq_t Req; PFSRASRpl_t Rpl; memset( &Req, 0, sizeof(Req)); MSGINIT( &Req, PFS_RAS, 0, sizeof(Req) ); strncpy( Req.r_Cell, pRas, sizeof(Req.r_Cell) ); strncpy( Req.r_Path, pPath, sizeof(Req.r_Path) ); Ret = SendStream( Fd, (char*)&Req, sizeof(Req) ); if( Ret ) { printf("ERR:SendStream[%s_%d]\n", pCell, j ); goto err1; } Len = sizeof(Rpl); Ret = RecvStream( Fd, (char*)&Rpl, Len ); if( Ret ) { printf("ERR:RecvStream[%s_%d]\n", pCell, j ); goto err1; } if( Rpl.r_Head.h_Error ) { errno = Rpl.r_Head.h_Error; perror(" "); } close( Fd ); exit( 0 ); err1: close( Fd ); err: exit( -1 ); }