Menu

Exec command build with multiple data items

2004-12-15
2013-04-08
  • sireesh tripurari

    Example :usage of Exec taken from

    Specs: DMRepPro Version: 1.1.2
    Section :6.5.6 

    <Exec>
           <CmdID>3</CmdID>
           <Item>
                  <Target>
                         <LocURI>./bin/shutdown</LocURI>
                  </Target>

                 <Data>argument1</Data>
                 <Data>argument2</Data>
                <Data>argument3</Data>
          </Item>
    </Exec>

    The structure for exec command (in file rtk\src\sml\inc\Smldtd.h) is
    /**
    * Exec command:
    **/
    typedef struct sml_exec_s {
      SmlProtoElement_t          elementType;
      SmlPcdataPtr_t        cmdID;     
      Flag_t                flags;      // NoResp
      SmlCredPtr_t          cred;       // opt.
      SmlPcdataPtr_t        meta;       // opt.
      SmlItemPtr_t          item;
    } *SmlExecPtr_t, SmlExec_t;

    Can you explain how can i use this structure to represent the Example?

     
    • Darryl Champagne

      Pretty much the same way as any other element:
      ->cmdID = 3;   (or foo.cmdID)
      ->item = [Some Item that you create]

      And within item, you set the target LocURI, etc.

      And of course, you have to alloc/create the item, and stuff within it, etc.

      You have to create a hiearchy of data structures, that matchs the XML Hiearchy.  See some of the other code, or the sample, for how to alloc/create the structs.

      dgc

       
    • Darryl Champagne

      And just to be clear, inside Item, the data field is a LIST of data's, as is any other data structure that allows multiples (per the DTD).
      dgc

       
    • sireesh tripurari

      Thanks Darryl,
      still i have some problems here again i will try to explain again with (respect to your replies).

      The structure for exec command (in file rtk\src\sml\inc\Smldtd.h) is
      /**
      * Exec command:
      **/
      typedef struct sml_exec_s {
      SmlProtoElement_t elementType;
      SmlPcdataPtr_t cmdID; 
      Flag_t flags; // NoResp
      SmlCredPtr_t cred; // opt.
      SmlPcdataPtr_t meta; // opt.
      SmlItemPtr_t item;
      } *SmlExecPtr_t, SmlExec_t;

      This is the structure i need to fill in right?
      now the SmlItemPtr_t item;
      this will contain the LocURI(stated by you in first reply) and data items(reference both the replies) as you know it.

      Here is the structure of SmlItemPtr_t
      typedef struct sml_item_s {
        SmlTargetPtr_t        target;     // opt.
        SmlSourcePtr_t        source;     // opt.
        SmlPcdataPtr_t        meta;       // opt.
        SmlPcdataPtr_t        data;       // opt.
        Flag_t                flags;      // opt. for MoreData
      } *SmlItemPtr_t, SmlItem_t;

      target and source as usual.
      meta if i have any thing to mention here
      flags; shouldn't matter unless its large object i.e. MoreData.

      Now this
        SmlPcdataPtr_t        data;       // opt.

      This has a structure as:
      typedef struct sml_pcdata_s {
        SmlPcdataType_t       contentType;     SmlPcdataExtension_t  extension;    
        MemSize_t             length;       
        VoidPtr_t             content;      
      } *SmlPcdataPtr_t, SmlPcdata_t;  

      I have removed the comment for clarity.;)
      as you mentioned in second reply that
      <reply2>"the data field is a LIST of data's"<reply2>

      thats why i posted the question how can i use this data file to attach list of data's?

      i have picked the latest version today again to check whether its possible or not?

      sorry for delay in reply?
      Thanks for your time and help.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.