<Other public methods of off_ShtlSrv. >+= (<-U) [<-D->]
// Returns a navigator for ShtlSrvs.
off_Navigator *get_navigator(void) { return NULL; }
<Off shuttle server dependencies. >+= (U->) [<-D->] #include <klib/nav.h> // for off_Navigator et al.
\subsubsection{Shuttle server inspection}
We have to implement these two methods.
<Other public methods of off_ShtlSrv. >+= (<-U) [<-D->]
// Get the ShtlSrv URL.
const char *get_url(void);
// Returns the ShtlSrv name.
const char *nameof(void);
The URL for an IO bank is that of its node with shtlsrv.html
appended. We use a new member, a character array initialized the very
first time it is needed.
<Other private members of off_ShtlSrv. >+= (<-U) [<-D->]
static char *s_url; // URL for this ShtlSrv.
<Off shuttle server static members. >+= (U->) [<-D] char *off_ShtlSrv::s_url=NULL; // URL for this ShtlSrv.
<off_ShtlSrv::get_url implementation. >= (U->)
// Get the ShtlSrv URL.
const char *off_ShtlSrv::get_url(void)
{
assert(valid());
if (!s_url){
s_url=new char[strlen(nd.get_url())+strlen(OFF_SHTLSRV_URL)+1]; //+1 for \0
if (s_url){
strcpy(s_url,nd.get_url());
strcat(s_url,OFF_SHTLSRV_URL);
}
}
return s_url;
}
Where he have to define the relative URL for shuttle servers.
<Off source code urls. >= [D->] const char OFF_SHTLSRV_URL[]="/shtlsrv.html";
<Off shuttle server dependencies. >+= (U->) [<-D] #include <klib/url.h> // for OFF_SHTLSRV_URL
<Off shuttle server implementation dependencies. >+= (U->) [<-D->] #include <string.h> // for strcat strdup et al #include <node/Node.h> // for nd
The name for shuttle server is that of its node complemented with a
little suffix. The implementation is almost the same of get_url.
<off_ShtlSrv::nameof implementation. >= (U->)
// Returns the shuttle server name.
const char *off_ShtlSrv::nameof(void)
{
assert(valid());
if (!s_name){
s_name = new char[strlen(nd.nameof())+strlen("/shtlsrv")+9]; // for N...N\0
if (s_name){
char number[9];
strcpy(s_name,nd.nameof());
strcat(s_name,"/shtlsrv");
sprintf(number,"%08x",(natural_t)get_id());
strcat(s_name,number);
}
}
return s_name;
}
<Other private members of off_ShtlSrv. >+= (<-U) [<-D]
char *s_name; // name for this ShtlSrv.
<Initialize other aggregate members of off_ShtlSrv. >+= (<-U) [<-D]
s_name(NULL)
<Other public methods of off_ShtlSrv. >+= (<-U) [<-D->]
// Returns an inspector for ShtlSrv.
off_Inspector *get_inspector(void) { return NULL; }
\subsubsection{Shuttle inspection}
<Other public methods of off_Shtl. >+= (<-U) [<-D]
// Returns an inspector for Shtl.
off_Inspector *get_inspector(void) { return NULL; }
We need get_rurl and get_url_holder for shuttles to support
ResUnit::get_url.
<Other protected methods of off_Shtl. >+= (<-U) [<-D->]
// Get the shtl url
virtual const char *get_rurl(void) const { return OFF_SHTL_URL; }
// Returns the shtl name.
virtual char *&get_url_holder(void);
He have to define the relative URL for shuttles
<Off source code urls. >+= [<-D] const char OFF_SHTL_URL[]="#Shtl";
DefinesOFF_SHTL_URL(links are to index).
<Off shuttle dependencies. >+= (U->) [<-D] #include <klib/url.h> // for OFF_SHTL_URL #include <stdio.h> // for sprintf et al
URLs are the same for all shuttles.
<Other private members of off_Shtl. >+= (<-U) [<-D]
static char *s_url; // URL for this shtl.
<off_Shtl::get_url_holder implementation. >= (U->)
char *&off_Shtl::get_url_holder(void) { return s_url; }
<Off shuttle static members. >= (U->) char *off_Shtl::s_url=NULL; // URL for shtl.
NOTE: Not yet implemented