feature_464832.txt

来自「Software Testing Automation Framework (S」· 文本 代码 · 共 764 行 · 第 1/2 页

TXT
764
字号
Feature ID  : 464832
Response Due: 06/18/2004
Title       : Add info on which interfaces are enabled


Description
-----------

This feature will provide support to show which interfaces
(aka connection providers) are enabled.


Problem(s) Solved
-----------------

In STAF 2.x, there are only two possible interfaces: local or
network. However, in STAF 3.0, there could be additional (multiple)
network interfaces enabled (e.g. tcp1, tcp2, or a pluggable
interface), but there's no way to tell which interfaces are enabled
(except by looking at the STAF.cfg file, if you have sufficient
trust access).

With the addition of this feature, you can now issue a request to
the MISC service to list and query enabled interfaces.


Related Features
----------------

Feature #550251 "Communication Interface Enhancements" provides the
ability to enable additional (multiple) interfaces, e.g. tcp1, tcp2,
or some other pluggable interface such as serial ports, SNA, NetBIOS.

Feature #740150 "New format for multi-valued result" will change
the results for the new list and query requests to the MISC service.
This format is not documented here yet as Feature #740150 is not
yet complete.

Feature #914310 "Need Support for IPV6" will be adding a new option
named PROTOCOL that can be set to ipv4 to specify IPv4 support only.


External Changes
----------------

1) MISC service changes

Add requests to the MISC service to list and query interfaces.

MISC service help

VERSION
MACHINE <Machine>
WHOAMI
LIST INTERFACES
QUERY INTERFACE <Interface>
HELP

a) LIST

Syntax:

  LIST INTERFACES

Security:

  Trust level 2

Result:

  If successful, the result will contain a line for each interface
  with the following format:

  <Interface Name>;<Library>;<Options>

  where <Options> is a semi-colon separated list of options for the
  interface.

Examples:

  Goal:  List all interfaces
  Request:  LIST INTERFACES
  Result:
    tcp;STAFTCP;PORT=6500;PROTOCOL=ipv6
    alt-tcp;STAFTCP;PORT=6700;PROTOCOL=ipv4
    local;STAFLIPC;IPCNAME=STAF

b) QUERY

Syntax:

  QUERY INTERFACE <Name>

  INTERFACE specifies the name of the interface to query.  
  This option will resolve variables.

Security:

  Trust level 2

Result:

  If successful, the result will be of the following format:

  Library    : <Implementation Library>
  Option #n  : <Name[=value]>   
  
  where there is a line for each option provided by the
  interface (e.g. Option #1, Option #2, etc.)

Examples:

  Goal:  List details about the interface named tcp:
  Request:  QUERY INTERFACE tcp
  Result:
    Library    : STAFTCP
    Option #1  : PORT=6500
    Option #2  : PROTOCOL=ipv6

  Goal:  List details about the interface named alt-tcp
  Request:  QUERY INTERFACE alt-tcp
  Result:
    Library    : STAFTCP
    Option #1  : PORT=6700
    Option #2  : PROTOCOL=ipv4

  Goal:  List details about the interface named local
  Request:  QUERY INTERFACE local
  Result:
    Library    : STAFLIPC
    Option #1  : IPCNAME=STAF


Internal Changes
----------------

1) STAFMiscService.cpp/h:

  a) Add a handleList method:

  Use the STAFConnectionManager::getConnectionProviderListCopy()
  method to get a list of all of the enabled interfaces and then
  for each interface, use its getLibrary and getMyOptionList
  methods to get its library name and its options.

  Return detailed information about the interface in a string.

  b) Add a handleQuery method:

  Use the STAFConnectionManager::getConnectionProviderListCopy()
  method to get a list of all of the enabled interfaces and then
  iterate thru the list to find the specified interface.  Use
  the interface's getLibrary and getMyOptionList methods to get
  its library name and its options.

  If the specified interface is not in the list, return
  kSTAFDoesNotExist, otherwise return detailed information
  about the interface in a string.

2) Changes to Connection Providers:

  a) stafif/STAFConnectionProvider.h:

  - Defined a new getLibrary method which returns a STAFString
    containing the name of the library for a connection provider.

  - Defined new STAFConnectionGetOptions and GetOptions methods
    to get the options defined for a connection provider.

    Note:  Currently, the options are being provided in a string,
    where multiple options are separated by a semi-colon.  Once
    the C/C++ marshalling methods are complete, the options will
    be provided in a STAF Data Type List format instead.
    
  b) LocalIPC and TCP Connection Providers:

     connectionproviders/tcp/STAFTCPConnProvider.cpp
     connectionproviders/localipc/win32/STAFLocalIPCConnProvider.cpp
     connectionproviders/localipc/unix/STAFLocalIPCConnProvider.cpp

  - Added the following fields to the STAFConnectionProviderImpl
    struct for each connection provider:
    
      STAFStringConst_t logicalNetworkID;
      STAFStringConst_t physicalNetworkID;

      unsigned int numOptions;
      STAFStringConst_t options;

  - Added a STAFConnectionProviderGetOptions method to each
    connection provider and implemented this method in each connection
    provider so that the connection provider could provide its options.
    This way, default values used for options will be provided in
    addition to any options specified when the interface is registered
    in the STAF configuration file.

  - The options are assigned during the connection provider's 
    STAFConnectionProviderConstruct() method.

    Note:  Also, moved the assignment of the logical and physical
    identifiers into the STAFConnectionProviderConstruct() method
    as well so that they are just assigned once and changed the
    getMyNetworkIdentifiers() method to return these values.

  c) stafif/STAFConnectionProviderInlImpl.cpp:

  - Added STAFString library as another parameter to the
    STAFConnectionProvider constructor.
   
  - Added a STAFConnectionProvider::getLibrary() method to provide
    the library name for a connection provider.
    This method is called by the new handleList and handleQuery 
    methods in STAFMiscService.cpp.

  - Added a STAFConnectionProvider::getOptions() method to provide
    the options for a connection provider.
    This method is called by the new handleList and handleQuery 
    methods in STAFMiscService.cpp.


Design Considerations
---------------------

- Currently, the options for connection providers are being 
  provided in a string, where multiple options are separated by a
  semi-colon.  Once the C/C++ methods for the marshalling feature
  are complete, the options will be provided in a STAF Data Type
  List format instead.


Backward Compatibility Issues
-----------------------------

None


Here's the CVS diff of all the changes:

Index: connproviders/localipc/STAFLIPC.def
===================================================================
RCS file: /cvsroot/staf/src/staf/connproviders/localipc/STAFLIPC.def,v
retrieving revision 1.2
diff -r1.2 STAFLIPC.def
7a8
> STAFConnectionProviderGetOptions
Index: connproviders/localipc/unix/STAFLocalIPCConnProvider.cpp
===================================================================
RCS file: /cvsroot/staf/src/staf/connproviders/localipc/unix/STAFLocalIPCConnProvider.cpp,v
retrieving revision 1.8
diff -r1.8 STAFLocalIPCConnProvider.cpp
110a111,115
> STAFRC_t STAFConnectionProviderGetOptions(
>     STAFConnectionProvider_t provider,
>     unsigned int *numOptions, STAFStringConst_t *options,
>     STAFString_t *errorBuffer);
> 
148a154
>     STAFConnectionProviderGetOptions,
165a172,177
>     
>     STAFStringConst_t logicalNetworkID;
>     STAFStringConst_t physicalNetworkID;
> 
>     unsigned int numOptions;
>     STAFStringConst_t options;
350a363,376
>         // Assign options (name[=value]) to a string, separating multiple
>         // options using a semi-colon.
>         // XXX: Change to create a STAF Data Type List (when available)
>         //      instead of a string with options separated by a semi-colon
>         lipcData.numOptions = 1;
>         lipcData.options = STAFString("IPCNAME=" +
>                                       lipcData.ipcName).adoptImpl();
> 
>         // Assign logical and physical identifiers
>         lipcData.logicalNetworkID = STAFString("local").adoptImpl();
>         lipcData.physicalNetworkID = STAFString("local").adoptImpl();
> 
>         *provider = new STAFConnectionProviderImpl(lipcData);
> 
658,659c684,685
<         *logicalID = STAFString("local").adoptImpl();
<         *physicalID = STAFString("local").adoptImpl();
---
>         *logicalID = provider->logicalNetworkID;
>         *physicalID = provider->physicalNetworkID;
668a695,714
> STAFRC_t STAFConnectionProviderGetOptions(
>     STAFConnectionProvider_t provider,
>     unsigned int *numOptions, STAFStringConst_t *options,
>     STAFString_t *errorBuffer)
> {
>     if (provider == 0) return kSTAFInvalidObject;
>     if (options  == 0) return kSTAFInvalidParm;
> 
>     try
>     {
>         *numOptions = provider->numOptions;
>         *options = provider->options;
> 
>         return kSTAFOk;
>     }
>     CATCH_STANDARD("STAFConnectionProviderGetOptions");
> 
>     return kSTAFUnknownError;
> }
> 
Index: connproviders/localipc/win32/STAFLocalIPCConnProvider.cpp
===================================================================
RCS file: /cvsroot/staf/src/staf/connproviders/localipc/win32/STAFLocalIPCConnProvider.cpp,v
retrieving revision 1.7
diff -r1.7 STAFLocalIPCConnProvider.cpp
100a101,105
> STAFRC_t STAFConnectionProviderGetOptions(
>     STAFConnectionProvider_t provider,
>     unsigned int *numOptions, STAFStringConst_t *options,
>     STAFString_t *errorBuffer);
> 
138a144
>     STAFConnectionProviderGetOptions,
159a166,171
>     
>     STAFStringConst_t logicalNetworkID;
>     STAFStringConst_t physicalNetworkID;
> 
>     unsigned int numOptions;
>     STAFStringConst_t options;
593a606,617
>         // Assign options (name[=value]) to a string, separating multiple
>         // options using a semi-colon.
>         // XXX: Change to create a STAF Data Type List (when available)
>         //      instead of a string with options separated by a semi-colon
>         lipcData.numOptions = 1;
>         lipcData.options = STAFString("IPCNAME=" +
>                                       lipcData.ipcName).adoptImpl();
> 
>         // Assign logical and physical identifiers
>         lipcData.logicalNetworkID = STAFString("local").adoptImpl();
>         lipcData.physicalNetworkID = STAFString("local").adoptImpl();
> 
850,851c874,875
<         *logicalID = STAFString("local").adoptImpl();
<         *physicalID = STAFString("local").adoptImpl();
---
>         *logicalID = provider->logicalNetworkID;
>         *physicalID = provider->physicalNetworkID;
860a885,904
> STAFRC_t STAFConnectionProviderGetOptions(
>     STAFConnectionProvider_t provider,
>     unsigned int *numOptions, STAFStringConst_t *options,
>     STAFString_t *errorBuffer)
> {
>     if (provider == 0) return kSTAFInvalidObject;
>     if (options  == 0) return kSTAFInvalidParm;
> 
>     try
>     {
>         *numOptions = provider->numOptions;
>         *options = provider->options;
> 
>         return kSTAFOk;
>     }
>     CATCH_STANDARD("STAFConnectionProviderGetOptions");
> 
>     return kSTAFUnknownError;
> }
> 
Index: connproviders/tcp/STAFTCP.def
===================================================================
RCS file: /cvsroot/staf/src/staf/connproviders/tcp/STAFTCP.def,v
retrieving revision 1.2
diff -r1.2 STAFTCP.def
7a8
> STAFConnectionProviderGetOptions
Index: connproviders/tcp/STAFTCPConnProvider.cpp
===================================================================
RCS file: /cvsroot/staf/src/staf/connproviders/tcp/STAFTCPConnProvider.cpp,v
retrieving revision 1.4
diff -r1.4 STAFTCPConnProvider.cpp
109a110,114
> STAFRC_t STAFConnectionProviderGetOptions(
>     STAFConnectionProvider_t provider,

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?