(file) Return to IPInfo.h CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Clients / ipinfo

  1 martin 1.12 //%LICENSE////////////////////////////////////////////////////////////////
  2 martin 1.13 //
  3 martin 1.12 // Licensed to The Open Group (TOG) under one or more contributor license
  4             // agreements.  Refer to the OpenPegasusNOTICE.txt file distributed with
  5             // this work for additional information regarding copyright ownership.
  6             // Each contributor licenses this file to you under the OpenPegasus Open
  7             // Source License; you may not use this file except in compliance with the
  8             // License.
  9 martin 1.13 //
 10 martin 1.12 // Permission is hereby granted, free of charge, to any person obtaining a
 11             // copy of this software and associated documentation files (the "Software"),
 12             // to deal in the Software without restriction, including without limitation
 13             // the rights to use, copy, modify, merge, publish, distribute, sublicense,
 14             // and/or sell copies of the Software, and to permit persons to whom the
 15             // Software is furnished to do so, subject to the following conditions:
 16 martin 1.13 //
 17 martin 1.12 // The above copyright notice and this permission notice shall be included
 18             // in all copies or substantial portions of the Software.
 19 martin 1.13 //
 20 martin 1.12 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
 21 martin 1.13 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 22 martin 1.12 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
 23             // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
 24             // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
 25             // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
 26             // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 27 martin 1.13 //
 28 martin 1.12 //////////////////////////////////////////////////////////////////////////
 29 kumpf  1.2  //
 30             //
 31             //%/////////////////////////////////////////////////////////////////////////////
 32             
 33             #ifndef Pegasus_IPInfoCommand_h
 34             #define Pegasus_IPInfoCommand_h
 35             
 36             #include <Pegasus/Common/String.h>
 37             #include <Pegasus/Client/CIMClient.h>
 38             #include <Clients/cliutils/Command.h>
 39             #include <Clients/cliutils/CommandException.h>
 40             #include "IPInfoException.h"
 41             
 42             PEGASUS_NAMESPACE_BEGIN
 43             PEGASUS_USING_STD;
 44             
 45             /**
 46                The osinfo command displays information regarding the operating
 47                system, gathered via WBEM using the PG_OperatingSystem class supported
 48 kumpf  1.14    by the OperatingSystem Provider.  osinfo requires CIM Server to be
 49 kumpf  1.2     installed and running on the target host.
 50 kumpf  1.14 
 51 karl   1.9     @author  Hewlett-Packard Company
 52 kumpf  1.14 
 53 kumpf  1.2   */
 54 kumpf  1.14 class IPInfoCommand : public Command
 55 kumpf  1.2  {
 56             public:
 57             
 58                 enum { DEFAULT_TIMEOUT_MILLISECONDS = 200000 };
 59             
 60                 /**
 61 kumpf  1.14 
 62 kumpf  1.2          Constructs an IPInfoCommand and initializes instance variables.
 63 kumpf  1.14 
 64 kumpf  1.2       */
 65                 IPInfoCommand ();
 66             
 67                 /**
 68 kumpf  1.14 
 69                     Parses the command line, validates the options, and sets instance
 70 kumpf  1.2          variables based on the option arguments.
 71 kumpf  1.14 
 72 kumpf  1.2          @param   argc  the number of command line arguments
 73                     @param   argv  the string vector of command line arguments
 74 kumpf  1.14 
 75                     @exception  CommandFormatException  if an error is encountered in
 76 kumpf  1.2                                              parsing the command line
 77 kumpf  1.14 
 78 kumpf  1.2       */
 79 david.dillard 1.7      void setCommand (Uint32 argc, char* argv []);
 80 kumpf         1.2  
 81                        /**
 82 kumpf         1.14 
 83 kumpf         1.2          Executes the command and writes the results to the PrintWriters.
 84 kumpf         1.14 
 85 kumpf         1.2          @param   outPrintWriter     the ostream to which output should be
 86                                                        written
 87                            @param   errPrintWriter     the ostream to which error output should be
 88                                                        written
 89 kumpf         1.14 
 90 kumpf         1.2          @return  0                  if the command is successful
 91                                     1                  if an error occurs in executing the command
 92 kumpf         1.14 
 93 kumpf         1.2       */
 94                        Uint32 execute (ostream& outPrintWriter, ostream& errPrintWriter);
 95                    
 96                        /**
 97                            The command name.
 98                         */
 99                        static const char   COMMAND_NAME [];
100 kumpf         1.14 
101 kumpf         1.2  private:
102                    
103                        /**
104 kumpf         1.14 
105 kumpf         1.2          Connect to cimserver.
106 kumpf         1.14 
107 kumpf         1.2          @param   outPrintWriter     the ostream to which error output should be
108                                                        written
109 kumpf         1.14 
110 kumpf         1.2          @exception Exception        if an error is encountered in creating
111 kumpf         1.14                                     the connection
112                    
113 kumpf         1.2       */
114                        void _connectToServer( CIMClient& client,
115 david.dillard 1.7                 ostream& outPrintWriter );
116 kumpf         1.2  
117                    /**
118 kumpf         1.14 
119 kumpf         1.2      Prompt for password.
120 kumpf         1.14 
121 kumpf         1.2      @param   estream             the ostream to which errors should be written
122                    
123                        @return  String value of the user entered password
124                    
125                     */
126                        String _promptForPassword( ostream&  eStream );
127                    
128 david.dillard 1.7      void getIPInfo (ostream& outPrintWriter, ostream& errPrintWriter);
129 kumpf         1.2  
130                        void errorExit(ostream& eStream, const String &message);
131                    
132                        void gatherProperties(CIMInstance &inst, Boolean cimFormat);
133                    
134                        void displayProperties(ostream& outPrintWriter);
135                    
136                        /**
137                            The host on which the command is to be executed.  A CIM Server must be
138                            running on this host when the command is executed.  The default host is
139                            the local host.
140                         */
141                        String _hostName;
142                    
143                        /**
144 kumpf         1.14         A Boolean indicating whether a hostname was specified on the command
145 kumpf         1.2          line.  The default host is the local host.
146                         */
147                        Boolean _hostNameSet;
148                    
149                        /**
150                    
151 kumpf         1.14         The port to be used when the command is executed. The
152                            port number must be the port number on which the
153 kumpf         1.2          target CIM Server is running.
154                    
155                            If no port is specified, osinfo will attempt to locate the port
156 kumpf         1.14         associated with the service "wbem-http" for non-SSL connections
157                            and "wbem-https" for SSL connections. If not found, the DMTF
158 kumpf         1.2          recommended default port number will be used.
159                    
160                            _portNumberStr and _portNumber are not used with
161                            connectLocal().
162 kumpf         1.14 
163 kumpf         1.2          The default port for non-SSL 5988 and 5989 for SSL.
164                    
165                         */
166                        String _portNumberStr;
167                        Uint32 _portNumber;
168                    
169                        /**
170                            A Boolean indicating whether a port number was specified on the
171 karl          1.9      command line.
172 kumpf         1.2       */
173                        Boolean _portNumberSet;
174                    
175                        /**
176                            The timeout value to be used, in milliseconds.
177                            The default timeout value is DEFAULT_TIMEOUT_MILLISECONDS.
178                         */
179                        Uint32 _timeout;
180                    
181                        /**
182 kumpf         1.14         The username to be used for authentication and
183 kumpf         1.2          authorization of the operation.
184                         */
185                        String _userName;
186                    
187                        /**
188                            Indicates that the user name is set.
189                         */
190                        Boolean _userNameSet;
191                    
192                        /**
193                            The password to be used for authentication.
194                         */
195                        String _password;
196                    
197                        /**
198                            Indicates that the password is set.
199                         */
200                        Boolean _passwordSet;
201                    
202                        /**
203 kumpf         1.14         A Boolean indicating whether an SSL connection was specified on the
204 kumpf         1.2          command line.
205                         */
206                        Boolean _useSSL;
207                    
208                        /**
209                            A Boolean indicating whether debugging is enabled
210                            using raw format.
211                         */
212                        Boolean _enableDebug;
213                    
214                        /**
215                            The option character used to specify the hostname.
216                         */
217                        static const char   _OPTION_HOSTNAME;
218                    
219                        /**
220                            The option character used to specify the port number.
221                         */
222                        static const char   _OPTION_PORTNUMBER;
223                    
224                        /**
225 kumpf         1.2          The option character used to specify the timeout value.
226                         */
227                        static const char   _OPTION_TIMEOUT;
228                    
229                        /**
230                            The option character used to specify the username.
231                         */
232                        static const char   _OPTION_USERNAME;
233                    
234                        /**
235                            The option character used to specify the password.
236                         */
237                        static const char   _OPTION_PASSWORD;
238                    
239                        /**
240                            The option character used to specify whether SSL should be used.
241                         */
242                        static const char   _OPTION_SSL;
243                    
244                        /**
245                            The option character used to specify whether DATETIME values
246 kumpf         1.2          should be formatted.
247                         */
248                        static const char   _OPTION_DEBUG;
249                    
250                        /**
251                            Label for the usage string for this command.
252                         */
253                        static const char   _USAGE [];
254 kumpf         1.14 
255 kumpf         1.2      /**
256                            The minimum valid portnumber.
257                         */
258                        static const Uint32 _MIN_PORTNUMBER;
259                    
260                        /**
261                            The maximum valid portnumber.
262                         */
263                        static const Uint32 _MAX_PORTNUMBER;
264                    
265                        /**
266 kumpf         1.14         The debug option argument value used to specify that the HTTP
267 kumpf         1.2          encapsulation of the original XML request be included in the output.
268                         */
269                        static const char   _DEBUG_OPTION1;
270                    
271                        /**
272 kumpf         1.14         The debug option argument value used to specify that the HTTP
273 kumpf         1.2          encapsulation of the XML response be included in the output.
274                         */
275                        static const char   _DEBUG_OPTION2;
276                    
277                    };
278                    
279                    class IPRouteInfo
280                    {
281 karl          1.9  public:
282 kumpf         1.14     IPRouteInfo(CIMClient &client, Boolean enableDebug,
283 kumpf         1.2                  ostream& outPrintWriter, ostream& errPrintWriter);
284                        ~IPRouteInfo(void);
285                    
286 karl          1.9  private:
287 kumpf         1.2      void _gatherProperties(CIMInstance &inst);
288                        void _outputHeader(ostream &outPrintWriter);
289                        void _outputInstance(ostream &outPrintWriter);
290                    
291                        // Keys
292                        String  _ipSCCN;
293                        String  _ipSN;
294                        String  _ipServiceCCN;
295                        String  _ipServiceN;
296                        String  _ipCCN;
297                        String  _ipIPDestAddr;
298                        String  _ipIPDestMask;
299                        Uint16  _ipAddrType;
300                    
301                        // Other properties to grab
302                        String  _ipCaption;
303                        String  _ipDescription;
304                        String  _ipName;
305                        String  _ipNextHop;
306                    
307                        Boolean _enableDebug;
308 kumpf         1.2  };
309                    
310                    
311                    class IPPEpInfo
312                    {
313 karl          1.9  public:
314 marek         1.3      IPPEpInfo(CIMClient &client, Boolean enableDebug,
315 kumpf         1.2                ostream &outPrintWriter, ostream &errPrintWriter);
316                        ~IPPEpInfo(void);
317                    
318 karl          1.9  private:
319 kumpf         1.2      void _gatherProperties(CIMInstance &inst);
320                        void _outputHeader(ostream &outPrintWriter);
321                        void _outputInstance(ostream &outPrintWriter);
322                    
323                        String  _ipSCCN;
324                        String  _ipSN;
325                        String  _ipCCN;
326                        String  _ipName;
327                    
328                        // Other properties to grab
329                        String  _ipCaption;
330                        String  _ipDescription;
331                        String  _ipNameFormat;
332                        Uint16  _ipProtocolType;
333                        String  _ipAddress;
334 mateus.baur   1.10     String _ipIPv6Address;
335                        String _ipIPv4Address;
336 kumpf         1.2      String  _ipSubnetMask;
337 mateus.baur   1.10     Uint8 _ipPrefixLength;
338 kumpf         1.2      Uint16  _ipAddrType;
339                        Uint16  _ipIPVersionSupport;
340 mateus.baur   1.10     Uint16 _ipProtocolIFType;
341 kumpf         1.2  
342                        Boolean _enableDebug;
343                    };
344                    
345                    class BIPTLEpInfo
346                    {
347 karl          1.9  public:
348 marek         1.3      BIPTLEpInfo(CIMClient &client, Boolean enableDebug,
349 kumpf         1.2                  ostream& outPrintWriter, ostream& errPrintWriter);
350                        ~BIPTLEpInfo(void);
351                    
352 karl          1.9  private:
353 kumpf         1.2      void _gatherProperties(CIMInstance &inst, ostream &outPrintWriter);
354 kumpf         1.14     void _extractFromKey(CIMObjectPath &ref, String &ccn,
355 kumpf         1.2                           String &name, ostream &outPrintWriter);
356                        void _outputHeader(ostream &outPrintWriter);
357                        void _outputInstance(ostream &outPrintWriter);
358                    
359                        // Properties from the keys
360                        String  _ipLEPName;
361                        String  _ipIPPEpName;
362                        String  _ipLEPCCN;
363                        String  _ipIPPEpCCN;
364                    
365                        // Other properties to grab
366                        Uint16  _ipFrameType;
367                    
368                        Boolean _enableDebug;
369                    };
370                    
371 mateus.baur   1.10 class NextHopIPRouteInfo
372                    {
373                    public:
374                        NextHopIPRouteInfo(
375 kumpf         1.14         CIMClient &client,
376 mateus.baur   1.10         Boolean enableDebug,
377 kumpf         1.14         ostream& outPrintWriter,
378 mateus.baur   1.10         ostream& errPrintWriter);
379                        ~NextHopIPRouteInfo(void);
380                    
381                    private:
382                        void _gatherProperties(CIMInstance &inst);
383                        void _outputHeader(ostream &outPrintWriter);
384                        void _outputInstance(ostream &outPrintWriter);
385                    
386                        // Keys
387                        String _ipInstanceID;
388                    
389                        // Other properties to grab
390                        String _ipIPDestAddr;
391                        String _ipIPDestMask;
392                        String _ipCaption;
393                        String _ipDescription;
394                        String _ipName;
395 mateus.baur   1.11     String _ipNextHop;
396 mateus.baur   1.10     Uint16 _ipAddrType;
397                        Uint8 _ipPrefixLength;
398                    
399                        Boolean _enableDebug;
400                    };
401                    
402 mateus.baur   1.11 class RSApInfo
403                    {
404                    public:
405                        RSApInfo(
406                            CIMClient &client,
407                            Boolean enableDebug,
408                            ostream& outPrintWriter,
409                            ostream& errPrintWriter);
410 kumpf         1.14     ~RSApInfo(void);
411 mateus.baur   1.11 
412                    private:
413                        void _gatherProperties(CIMInstance &inst);
414                        void _outputHeader(ostream &outPrintWriter);
415                        void _outputInstance(ostream &outPrintWriter);
416                    
417                        // Keys.
418                        String _accessInfo;
419                    
420                        // Other properties.
421                        Uint16 _infoFormat;
422                        String _otherInfoFmtDesc;
423                    
424                        Boolean _enableDebug;
425                    };
426                    
427 kumpf         1.2  
428                    PEGASUS_NAMESPACE_END
429                    
430                    #endif /* Pegasus_IPInfoCommand_h */

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2