components/net-snmp/sun/agent/modules/entityMib/entity_apidoc.txt
changeset 252 ee0fb1eabcbf
equal deleted inserted replaced
251:f527656d334f 252:ee0fb1eabcbf
       
     1 #
       
     2 # Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
       
     3 #
       
     4 # U.S. Government Rights - Commercial software. Government users are subject
       
     5 # to the Sun Microsystems, Inc. standard license agreement and applicable
       
     6 # provisions of the FAR and its supplements.
       
     7 #
       
     8 #
       
     9 # This distribution may include materials developed by third parties. Sun,
       
    10 # Sun Microsystems, the Sun logo and Solaris are trademarks or registered
       
    11 # trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
       
    12 #
       
    13 #
       
    14 
       
    15 List of Entity MIB APIs
       
    16 -----------------------
       
    17 
       
    18 Physical Table (entPhysicalTable)
       
    19 ---------------------------------
       
    20 extern int allocPhysicalEntry(int physidx, entPhysicalEntry_t *newPhysEntry);
       
    21 
       
    22   - Allocates an entry in the Physical Table. The physidx parameter
       
    23     is the physical index requested. If physidx = 0, it will try to use
       
    24     the first available index in the table.  If physidx > 0, then it will try
       
    25     to use the slot indicated by the index.
       
    26 
       
    27     The API returns a physical index alloted to the entry, and this may or may
       
    28     not be the same as the requested physical index.
       
    29 
       
    30     The memory associated with newPhysEntry can be freed. The API creates an
       
    31     internal copy of the data.
       
    32 
       
    33     Returns:
       
    34     - the index allocated to the physical entry
       
    35     - -1 for error in adding the entry
       
    36 
       
    37     Check the log for more details.
       
    38 
       
    39     NOTE: The physidx (other than 0) is not used in this release of the API,
       
    40           this is present for future purposes.
       
    41 
       
    42 entPhysicalEntry_t *getPhysicalTableEntry(int index);
       
    43 
       
    44   - This API returns the actual Physical Table entry for the
       
    45     particular index. The caller must NOT change the values or release
       
    46     the memory of the entry that is returned.
       
    47 
       
    48     Returns:
       
    49     - the entry for that index
       
    50     - NULL on error in finding the entry or if the entry is stale
       
    51 
       
    52 extern int deletePhysicalTableEntry(int xPhysicalIndex);
       
    53 
       
    54   - Delete the Physical Table entry associated with the xPhysicalIndex. The
       
    55     instances of xPhysicalIndex in the Alias Mapping Table, LP Mapping Table
       
    56     and the Physical Contains Table will also be deleted to maintain
       
    57     integrity among the various Entity MIB tables.
       
    58  
       
    59     Returns:
       
    60     - 0 for success
       
    61     - -1 if the xPhysicalIndex is not found
       
    62     - -2 if a stale entry was found for xPhysicalIndex.
       
    63 
       
    64 extern int makePhysicalTableEntryStale(int xPhysicalIndex);
       
    65 
       
    66   - Makes the Physical Table entry associated with the xPhysicalIndex stale. 
       
    67     Stale means that the entry details are present in the agent's memory but
       
    68     it will not be displayed during any SNMP operation. The entry can be
       
    69     made available again with the call to the makePhysicalTableEntryLive
       
    70     API.
       
    71     The index allocated to a stale entry will not be allocated to another
       
    72     entry.
       
    73 
       
    74     The instances of xPhysicalIndex in the Alias Mapping Table, LP Mapping
       
    75     Table and the Physical Contains Table will be deleted to maintain
       
    76     integrity among the various Entity MIB tables.
       
    77  
       
    78     Returns:
       
    79     - 0 for success
       
    80     - -1 if the xPhysicalIndex is not found
       
    81     - -2 if a stale entry already exists for xPhysicalIndex.
       
    82 
       
    83 extern int makePhysicalTableEntryLive(int xPhysicalIndex);
       
    84 
       
    85   - Makes the stale Physical Table entry associated with the xPhysicalIndex 
       
    86     live.
       
    87     Live means that the entry details that are present in the agent's memory 
       
    88     will be displayed during SNMP operations. The entry can be
       
    89     made stale with the call to the makePhysicalTableEntryStale API.
       
    90 
       
    91     Returns:
       
    92     - 0 for success
       
    93     - -1 if the xPhysicalIndex is not found
       
    94     - -2 if a live entry already exists for xPhysicalIndex.
       
    95 
       
    96 entPhysicalEntry_t *getPhysicalStaleEntry(int index);
       
    97 
       
    98   - This API returns the stale Physical Table entry for the
       
    99     particular index. The caller must NOT change the values or release
       
   100     the memory of the entry that is returned.
       
   101 
       
   102     Returns:
       
   103     - the stale entry for that index
       
   104     - NULL on error in finding the entry or if a live entry exists.
       
   105 
       
   106 int *getAllChildrenFromPhysicalContainedIn(int parentIndex);
       
   107 
       
   108   - Get the indexes for all the children in the Physical Table which has
       
   109     parentIndex as their parent (in the entPhysicalContainedIn field).
       
   110 
       
   111     Returns:
       
   112     - returns an array of indexes (integers) with null termination
       
   113     - NULL if no children, or invalid index, or not enough memory when
       
   114       allocating the array
       
   115 
       
   116     NOTE: The array is a copy and SHOULD be freed when done
       
   117 
       
   118 Logical Table (entLogicalTable)
       
   119 -------------------------------
       
   120 
       
   121 extern int allocLogicalEntry(int logidx, entLogicalEntry_t * xnewLogicalEntry);
       
   122 
       
   123   - Allocates an entry in the Logical Table. The logidx parameter
       
   124     is the logical index requested. If logidx = 0, it will try to use
       
   125     the first available index in the table.  If physidx > 0, then it will try
       
   126     to use the slot indicated by the index.
       
   127 
       
   128     The API returns a logical index alloted to the entry, and this may or may
       
   129     not be the same as the requested logical index.
       
   130 
       
   131     The memory associated with xnewLogicalEntry can be freed. The API creates
       
   132     an internal copy of the data.
       
   133 
       
   134     Returns:
       
   135     - the index allocated to the logical entry
       
   136     - -1 for error in adding the entry
       
   137 
       
   138     Check the log for more details.
       
   139     
       
   140     NOTE: The logidx (other than 0) is not used in this release of the API,
       
   141           this is present for future purposes.
       
   142 
       
   143 
       
   144 entLogicalEntry_t* getLogicalTableEntry(int xLogicalIndex);
       
   145 
       
   146   - This API returns the actual Logical Table entry for the
       
   147     particular index. The caller must NOT change the values or release
       
   148     the memory of the entry that is returned.
       
   149 
       
   150     Returns:
       
   151     - the entry for that index
       
   152     - NULL on error in finding the entry or if a stale entry exists.
       
   153 
       
   154 extern int deleteLogicalTableEntry(int xLogicalIndex);
       
   155 
       
   156   - Delete the Logical Table entry associated with the xLogicalIndex. The
       
   157     instances of xLogicalIndex in the Alias Mapping Table, and the 
       
   158     LP Mapping Table will also be deleted to maintain integrity among the 
       
   159     various Entity MIB tables.
       
   160 
       
   161     Returns:
       
   162     - 0 for success
       
   163     - -1 if the xLogicalIndex is not found
       
   164     - -2 if a stale entry was found for xLogicalIndex.
       
   165 
       
   166 extern int makeLogicalTableEntryStale(int xLogicalIndex);
       
   167 
       
   168   - Makes the Logical Table entry associated with the xLogicalIndex stale.
       
   169     Stale means that the entry details are present in the agent's memory but
       
   170     it will not be displayed during any SNMP operation. The entry can be
       
   171     made available again with the call to the makeLogicalTableEntryLive API.
       
   172     The index allocated to a stale entry will not be allocated to another
       
   173     entry.
       
   174 
       
   175     The instances of xLogicalIndex in the Alias Mapping Table, and the 
       
   176     LP Mapping Table will be deleted to maintain integrity among the various 
       
   177     Entity MIB tables.
       
   178 
       
   179     Returns:
       
   180     - 0 for success
       
   181     - -1 if the xPhysicalIndex is not found
       
   182     - -2 if a stale entry already exists for xPhysicalIndex.
       
   183 
       
   184 extern int makeLogicalTableEntryLive(int xLogicalIndex);
       
   185 
       
   186   - Makes the stale Logical Table entry associated with the xLogicalIndex
       
   187     live.
       
   188     Live means that the entry details that are present in the agent's memory
       
   189     will be displayed during SNMP operations. The entry can be
       
   190     made stale with the call to the makeLogicalTableEntryStale API.
       
   191 
       
   192     Returns:
       
   193     - 0 for success
       
   194     - -1 if the xLogicalIndex is not found
       
   195     - -2 if a live entry already exists for xLogicalIndex.
       
   196 
       
   197 entLogicalEntry_t *getLogicalStaleEntry(int index);
       
   198 
       
   199   - This API returns the stale Logical Table entry for the
       
   200     particular index. The caller must NOT change the values or release
       
   201     the memory of the entry that is returned.
       
   202 
       
   203     Returns:
       
   204     - the stale entry for that index
       
   205     - NULL on error in finding the entry or if a live entry exists.
       
   206 
       
   207 LP Mapping Table (entLPMappingTable)
       
   208 ------------------------------------
       
   209 extern int addLPMappingTableEntry(int xentLogicalIndex, int xentPhysicalIndex);
       
   210 
       
   211   - Adds an entry to the LP Mapping Table with the xentLogicalIndex as the
       
   212     primary index and xentPhysicalIndex as the secondary index.
       
   213 
       
   214     Returns:
       
   215     - 0 for successful addition
       
   216     - 1 if the entry for the given xentPhysicalIndex and
       
   217       xentLogicalIndex already exists.
       
   218     - -1 for failure
       
   219 
       
   220 extern int deleteLPMappingTableEntry(int xLogicalIndex, int xPhysicalIndex);
       
   221 
       
   222   - Deletes the entry of the LP Mapping Table with the xLogicalIndex as 
       
   223     the primary index and xPhysicalIndex as the secondary index.
       
   224 
       
   225     Returns:
       
   226     - 0 for successful deletion
       
   227     - -1 for failure
       
   228     - -2 for stale entry (either logical or physical index, or both)
       
   229 
       
   230 extern int deleteLPMappingLogicalIndex(int xentLogicalIndex);
       
   231 
       
   232   - Deletes all the entries of the LP Mapping Table with the xentLogicalIndex
       
   233     as the primary index.
       
   234 
       
   235     Returns:
       
   236     - number of deleted entries for successful deletion
       
   237     - -1 for failure
       
   238     - -2 for stale logical entry
       
   239 
       
   240 extern int deleteLPMappingPhysicalIndex(int xentPhysicalIndex);
       
   241 
       
   242   - Deletes all the entries of the LP Mapping Table with the xentPhysicalIndex
       
   243     as the secondary index.
       
   244 
       
   245     Returns:
       
   246     - number of deleted entries for successful deletion
       
   247     - -1 if no entry was deleted.
       
   248     - -2 for stale physical entry
       
   249 
       
   250 Alias Mapping Table (entAliasMappingTable)
       
   251 ------------------------------------------
       
   252 extern int addAliasMappingTableEntry(int xentPhysicalIndex, int xentLogicalIndex, oid* xAliasMapId, int xAliasMapIdSize);
       
   253 
       
   254   - Adds an entry to the Alias Mapping Table with xentPhysicalIndex as 
       
   255     the primary index and xentLogicalIndex as the secondary index.
       
   256     xAliasMapId is the alias (OID) for the entry and xAliasMapIdSize is a size
       
   257     in bytes of xAliasMapId
       
   258 
       
   259     Returns:
       
   260     - 0 for successful addition
       
   261     - 1 if the entry already exists for the given xentPhysicalIndex and
       
   262       xentLogicalIndex already exists.
       
   263     - -1 for failure
       
   264 
       
   265 extern int deleteAliasMappingTableEntry(int xentPhysicalIndex, int xentLogicalIndex);
       
   266 
       
   267   - Deletes the entry of the Alias Mapping Table with xentPhysicalIndex as
       
   268     the primary index and xentLogicalIndex as the secondary index.
       
   269 
       
   270     Returns:
       
   271     - 0 for successful deletion
       
   272     - -1 for entry not found
       
   273     - -2 for stale entry
       
   274 
       
   275 extern int deleteAliasMappingLogicalIndex(int xentLogicalIndex);
       
   276 
       
   277   - Deletes all the entries of the Alias Mapping Table with the 
       
   278     xentLogicalIndex as the secondary index
       
   279 
       
   280     Returns:
       
   281     - number of deleted entries for successful deletion
       
   282     - -1 for entry not found
       
   283     - -2 for stale logical entry
       
   284 
       
   285     NOTE: This API cannot be used to delete all indexes with
       
   286           xentLogicalIndex = 0. Use the deleteAliasMappingTableEntry API
       
   287           to delete such entries one by one, with the appropriate
       
   288           entPhysicalIndex specified.
       
   289 
       
   290 extern int deleteAliasMappingPhysicalIndex(int xentPhysicalIndex);
       
   291 
       
   292   - Deletes all the entries in the Alias Mapping Table with the
       
   293     primary index same as the given physical index
       
   294 
       
   295     Returns:
       
   296     - number of deleted entries for on success
       
   297     - -1 for entry not found
       
   298     - -2 for stale physical entry
       
   299 
       
   300 Physical Contains Table (entPhysicalContainsTable)
       
   301 --------------------------------------------------
       
   302 extern int addPhysicalContainsTableEntry(int entPhysicalIndex, int childIndex);
       
   303 
       
   304   - Adds an entry to the Physical Contains Table for the given entPhysicalIndex
       
   305     and childIndex. The entPhysicalContainedIn OID present in the Physical
       
   306     Table for the childIndex will be replaced by the entPhysicalIndex if the
       
   307     entPhysicalIndex has a lower index than the original one
       
   308 
       
   309     Returns:
       
   310     - 0 for successful addition
       
   311     - 1 if the entry already exists for the given entPhysicalIndex and
       
   312       childIndex.
       
   313     - -1 for failure to add.
       
   314 
       
   315 
       
   316 extern int deletePhysicalContainsTableEntry(int parentIndex, int childIndex);
       
   317 
       
   318   - Deletes the parentIndex/childIndex entry present in the Physical Contains
       
   319     Table.
       
   320 
       
   321     Returns:
       
   322     - 0 for success
       
   323     - -1 for failure
       
   324     - -2 for stale entry (either parent or child, or both)
       
   325 
       
   326 extern int deletePhysicalContainsParentIndex(int parentIndex);
       
   327 
       
   328   - Deletes all the entries in the Physical Contains Table where the parent
       
   329     index = parentIndex.
       
   330 
       
   331     Returns:
       
   332     - number of children deleted for that parent
       
   333     - -1 for failure
       
   334     - -2 for stale parent entry
       
   335 
       
   336 extern int deletePhysicalContainsChildIndex(int childIndex);
       
   337 
       
   338   - Deletes all the entries in the Physical Contains Table where the child
       
   339     index = childIndex.
       
   340 
       
   341     Returns:
       
   342     - number of parents deleted for that child
       
   343     - -1 for failure
       
   344     - -2 for stale child entry
       
   345 
       
   346 extern int* getPhysicalContainsChildren(int parentIndex);
       
   347 
       
   348   - Get the indexes for all the children in the Physical Contains
       
   349     Table, given a parent.
       
   350 
       
   351     Returns:
       
   352     - returns an array of indexes (integers) with null termination
       
   353     - NULL if no children, or not enough memory when allocating the array
       
   354 
       
   355     NOTE: The array is a copy and SHOULD be freed when done
       
   356 
       
   357 Data Structures
       
   358 ---------------
       
   359 The corresponding header files will be public interfaces as well, because the
       
   360 data structures are defined there. 
       
   361 
       
   362 typedef struct entPhysicalEntry_s {
       
   363     int entPhysicalIndex;
       
   364     char *entPhysicalDescr;
       
   365     oid *entPhysicalVendorType;
       
   366     int entPhysicalVendorTypeSize;
       
   367     int entPhysicalContainedIn;
       
   368     int entPhysicalClass;               /* see ENTPHYSICAL_CLASS_XXX */
       
   369     int entPhysicalParentRelPos;
       
   370     char *entPhysicalName;
       
   371     char *entPhysicalHardwareRev;
       
   372     char *entPhysicalFirmwareRev;
       
   373     char *entPhysicalSoftwareRev;
       
   374     char *entPhysicalSerialNum;
       
   375     char *entPhysicalMfgName;
       
   376     char *entPhysicalModelName;
       
   377     char *entPhysicalAlias;
       
   378     char *entPhysicalAssetID;
       
   379     int entPhysicalIsFRU;
       
   380     struct entPhysicalEntry_s *pNextEntry;
       
   381 } entPhysicalEntry_t;
       
   382 
       
   383 typedef struct entLogicalEntry_s {
       
   384     int   entLogicalIndex;
       
   385     char *entLogicalDescr;
       
   386     oid  *entLogicalType;
       
   387     int   entLogicalTypeSize;
       
   388     char *entLogicalCommunity;
       
   389     char *entLogicalTAddress;
       
   390     oid  *entLogicalTDomain;
       
   391     int   entLogicalTDomainSize;
       
   392     char *entLogicalContextEngineId;
       
   393     char *entLogicalContextName;
       
   394     struct entLogicalEntry_s* pNextEntry;
       
   395 } entLogicalEntry_t;