Commit cb51e1cc authored by claes's avatar claes

Parent oid added to nameToObject

parent ed9eac8c
/*
* Proview $Id: remote_pvd_pwrcli.cpp,v 1.1 2006-09-14 14:17:44 claes Exp $
* Proview $Id: remote_pvd_pwrcli.cpp,v 1.2 2007-03-20 12:36:38 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -40,8 +40,11 @@ extern "C" {
#include "rt_gdb.h"
#include "co_cdh.h"
#include "co_dcli.h"
#include "co_time.h"
}
#define max(Dragon,Eagle) ((Dragon) > (Eagle) ? (Dragon) : (Eagle))
class subitem {
public:
int m_size;
......@@ -50,7 +53,7 @@ class subitem {
int m_offset;
pwr_tOName m_attr;
pwr_tOid m_oid;
subitem() : m_size(0), m_p(0), m_cid(0), m_offset(0) {
subitem() : m_size(0), m_p(0), m_cid(0), m_offset(0) {
m_oid = pwr_cNObjid;
strcpy( m_attr,"");
}
......@@ -93,6 +96,15 @@ static char rpvd_vname[32];
static int rpvd_opsys;
static map<int, subitem> rpvd_sublist;
static int rpvd_id = 1;
const bool pvd_cLog = false;
static void logg( char *logger, pwr_tOix oix, char *text)
{
char nowstr[40];
time_AtoAscii( 0, time_eFormat_Time, nowstr, sizeof(nowstr));
printf( "%15s %30s %10d %s\n", nowstr, logger, oix, text);
}
void remote_pvd_pwrcli::objectOid( co_procom *pcom, pwr_tOix oix)
{
......@@ -105,6 +117,8 @@ void remote_pvd_pwrcli::objectOid( co_procom *pcom, pwr_tOix oix)
msg.Oid.oix = oix;
msg.Oid.vid = rpvd_vid;
if ( pvd_cLog) logg( "ObjOid", oix, "");
sts = udp_Request( (char *)&msg, sizeof(msg), (char **)&rmsg);
if ( EVEN(sts) || sts == REM__TIMEOUT) {
pcom->provideStatus( sts);
......@@ -140,7 +154,7 @@ void remote_pvd_pwrcli::objectOid( co_procom *pcom, pwr_tOix oix)
pcom->provideObjects( GDH__SUCCESS, m_list);
}
void remote_pvd_pwrcli::objectName( co_procom *pcom, char *name)
void remote_pvd_pwrcli::objectName( co_procom *pcom, char *name, pwr_tOix poix)
{
rpvd_sMsgObjectName msg;
rpvd_sMsgObject *rmsg;
......@@ -149,7 +163,11 @@ void remote_pvd_pwrcli::objectName( co_procom *pcom, char *name)
msg.Type = rpvd_eMsg_ObjectName;
msg.Id = rpvd_id++;
strcpy( msg.Name, name);
msg.POid.vid = rpvd_vid;
msg.POid.oix = poix;
if ( pvd_cLog) logg( "ObjName", poix, name);
sts = udp_Request( (char *)&msg, sizeof(msg), (char **)&rmsg);
if ( EVEN(sts) || sts == REM__TIMEOUT) {
pcom->provideStatus( sts);
......@@ -239,6 +257,8 @@ void remote_pvd_pwrcli::writeAttribute( co_procom *pcom, pwr_tOix oix,
}
}
if ( pvd_cLog) logg( "Write", aref.Objid.oix, aname);
sts = udp_Request( (char *)&msg, sizeof(msg), (char **)&rmsg);
if ( EVEN(sts) || sts == REM__TIMEOUT) {
pcom->provideStatus( sts);
......@@ -288,6 +308,9 @@ void remote_pvd_pwrcli::readAttribute( co_procom *pcom, pwr_tOix oix,
}
strcpy( msg.Attribute, aname);
if ( pvd_cLog) logg( "Read", aref.Objid.oix, aname);
sts = udp_Request( (char *)&msg, sizeof(msg), (char **)&rmsg);
if ( EVEN(sts) || sts == REM__TIMEOUT) {
pcom->provideStatus( sts);
......@@ -319,7 +342,7 @@ void remote_pvd_pwrcli::readAttribute( co_procom *pcom, pwr_tOix oix,
memset( &n, 0, sizeof(n));
n.os = (co_eOS) rpvd_opsys;
p = malloc( rmsg->Size);
p = malloc( max(rmsg->Size, (int)aref.Size));
size = aref.Size;
cp = (gdb_sClass *) hash_Search(&sts, gdbroot->cid_ht, &cid);
if (cp != NULL) {
......@@ -433,6 +456,8 @@ void remote_pvd_pwrcli::subAssociateBuffer( co_procom *pcom, void **buff, int oi
msg.Size = size;
if ( pvd_cLog) logg( "AssoBuff", msg.Oid.oix, aname);
sts = udp_Request( (char *)&msg, sizeof(msg), (char **)&rmsg);
if ( EVEN(sts) || sts == REM__TIMEOUT) {
pcom->provideStatus( sts);
......@@ -476,6 +501,8 @@ void remote_pvd_pwrcli::subDisassociateBuffer( co_procom *pcom, pwr_tSubid subid
msg.Id = rpvd_id++;
msg.Rix = subid.rix;
if ( pvd_cLog) logg( "DisoBuff", subid.rix, "(rix)");
sts = udp_Request( (char *)&msg, sizeof(msg), (char **)&rmsg);
if ( EVEN(sts) || sts == REM__TIMEOUT) {
pcom->provideStatus( sts);
......
/*
* Proview $Id: remote_pvd_pwrcli.h,v 1.1 2006-09-14 14:17:44 claes Exp $
* Proview $Id: remote_pvd_pwrcli.h,v 1.2 2007-03-20 12:36:38 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -30,7 +30,7 @@ public:
remote_pvd_pwrcli( pvd_eEnv env = pvd_eEnv_Rt) : co_provider(env) {}
virtual void object( co_procom *pcom) {}
virtual void objectOid( co_procom *pcom, pwr_tOix oix);
virtual void objectName( co_procom *pcom, char *name);
virtual void objectName( co_procom *pcom, char *name, pwr_tOix poix);
virtual void objectBody( co_procom *pcom, pwr_tOix oix) {}
virtual void createObject( co_procom *pcom, pwr_tOix destoix, int desttype,
pwr_tCid cid, char *name) {}
......
/*
* Proview $Id: remote_pvd_pwrsrv.c,v 1.1 2006-09-14 14:17:44 claes Exp $
* Proview $Id: remote_pvd_pwrsrv.c,v 1.2 2007-03-20 12:36:38 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -151,11 +151,27 @@ static void pwrsrv_ObjectName( rpvd_sMsgObjectName *msg)
{
rpvd_sMsgOid m;
pwr_tStatus sts;
char name[256];
/* Simulate an oid request */
m.Type = rpvd_eMsg_Oid;
m.Id = msg->Id;
sts = gdh_NameToObjid( msg->Name, &m.Oid);
if ( msg->POid.oix) {
sts = gdh_ObjidToName( msg->POid, name, sizeof(name), cdh_mName_volumeStrict);
if ( EVEN(sts)) {
rpvd_sMsgObject rmsg;
rmsg.Type = rpvd_eMsg_Object;
rmsg.Id = msg->Id;
rmsg.Status = sts;
udp_Send( (char *)&rmsg, sizeof(rmsg));
return;
}
strcat( name, "-");
strcat( name, msg->Name);
}
else
strncpy( name, msg->Name, sizeof(name));
sts = gdh_NameToObjid( name, &m.Oid);
if ( EVEN(sts)) {
rpvd_sMsgObject rmsg;
rmsg.Type = rpvd_eMsg_Object;
......
/*
* Proview $Id: remote_pvd_udp.h,v 1.1 2006-09-14 14:17:44 claes Exp $
* Proview $Id: remote_pvd_udp.h,v 1.2 2007-03-20 12:36:38 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -70,6 +70,7 @@ typedef struct {
int Id;
int Status;
pwr_tOName Name;
pwr_tOid POid;
} rpvd_sMsgObjectName;
typedef struct {
......
/*
* Proview $Id: co_provider.h,v 1.1 2006-09-14 14:16:07 claes Exp $
* Proview $Id: co_provider.h,v 1.2 2007-03-20 12:36:38 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -36,7 +36,7 @@ public:
virtual ~co_provider() {}
virtual void object( co_procom *pcom) {}
virtual void objectOid( co_procom *pcom, pwr_tOix oix) {}
virtual void objectName( co_procom *pcom, char *name) {}
virtual void objectName( co_procom *pcom, char *name, pwr_tOix poix) {}
virtual void objectBody( co_procom *pcom, pwr_tOix oix) {}
virtual void createObject( co_procom *pcom, pwr_tOix destoix, int desttype,
pwr_tCid cid, char *name) {}
......
/*
* Proview $Id: rt_procom.cpp,v 1.1 2006-09-14 14:16:07 claes Exp $
* Proview $Id: rt_procom.cpp,v 1.2 2007-03-20 12:36:38 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -918,7 +918,7 @@ pvd_NameToObject (
net_sNameToObject *mp = (net_sNameToObject *)get->data;
pvd_procom->m_getmsg = get;
pvd_procom->m_provider->objectName( pvd_procom, mp->name);
pvd_procom->m_provider->objectName( pvd_procom, mp->name, mp->poid.oix);
}
static void
......@@ -1366,6 +1366,7 @@ void rt_procom::provideStatus( pwr_tStatus rsts)
net_Reply(&sts, m_getmsg, &put, 0);
break;
}
case net_eMsg_nameToObject:
case net_eMsg_oidToObject: {
respondError( m_getmsg, pwr_cNObjid, sts);
break;
......
/*
* Proview $Id: rt_pvd_file.cpp,v 1.1 2006-09-15 09:33:20 claes Exp $
* Proview $Id: rt_pvd_file.cpp,v 1.2 2007-03-20 12:36:38 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -68,7 +68,7 @@ void rt_pvd_file::objectOid( co_procom *pcom, pwr_tOix oix)
}
}
void rt_pvd_file::objectName( co_procom *pcom, char *name)
void rt_pvd_file::objectName( co_procom *pcom, char *name, pwr_tOix poix)
{
for ( int i = 0; i < (int) m_list.size(); i++) {
......
/*
* Proview $Id: rt_pvd_file.h,v 1.1 2006-09-15 09:33:20 claes Exp $
* Proview $Id: rt_pvd_file.h,v 1.2 2007-03-20 12:36:38 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -29,7 +29,7 @@ public:
rt_pvd_file( pvd_eEnv env = pvd_eEnv_Wb) : co_provider(env), root(0), next_oix(1) {}
virtual void object( co_procom *pcom);
virtual void objectOid( co_procom *pcom, pwr_tOix oix);
virtual void objectName( co_procom *pcom, char *name);
virtual void objectName( co_procom *pcom, char *name, pwr_tOix poix);
virtual void objectBody( co_procom *pcom, pwr_tOix oix);
virtual void createObject( co_procom *pcom, pwr_tOix destoix, int desttype,
pwr_tCid cid, char *name);
......
/*
* Proview $Id: wb_provider.cpp,v 1.7 2006-09-15 09:33:20 claes Exp $
* Proview $Id: wb_provider.cpp,v 1.8 2007-03-20 12:36:38 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -155,7 +155,7 @@ void wb_procom::dispatch( vext_sQMsg *qmsg)
break;
case vext_eMsgType_ObjectName:
// printf( "ObjectName %s\n", qmsg->ObjectName.Name);
m_provider->objectName( this, qmsg->ObjectName.Name);
m_provider->objectName( this, qmsg->ObjectName.Name, 0);
break;
case vext_eMsgType_CreateObject:
// printf( "CreateObject %s\n", qmsg->CreateObject.Name);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment