Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

slp_debug.h

Go to the documentation of this file.
00001 /****************************************************************************/
00002 /* slp_debug                                                                */
00003 /* Creation Date: Wed May 24 14:26:50 EDT 2000                              */
00004 /****************************************************************************/
00005 #include <stdio.h>
00006 #include<stdlib.h>
00007 #define MAX_STRING_LENGTH               4096
00008 
00009 typedef struct {
00010         SLPError        error_number;
00011         char            *label;
00012         char            *description;
00013 } SLPErrorEntry;
00014 
00015 SLPErrorEntry error_entries[] = {
00016         {SLP_LAST_CALL,
00017                 "SLP_LAST_CALL",
00018                 "Passed to callback functions when the API library has no more data for them and therefore no further calls will be made to the callback on the currently outstanding operation. The callback can use this to signal the main body of the client code that no more data will be forthcoming on the operation, so that the main body of the client code can break out of data collection loops. On the last call of a callback during both a synchronous and synchronous call, the error code parameter has value SLP_LAST_CALL, and the other parameters are all NULL. If no results are returned by an API operation, then only one call is made , with the error parameter set to SLP_LAST_CALL."},
00019         {SLP_OK,
00020                  "SLP_OK",
00021                  "No DA or SA has service advertisement or attribute information in the language requested, but at least one DA or SA indicated, via the LANGUAGE_NOT_SUPPORTED error code, that it might have information for that service in another language"},
00022         //SLP_LANGUAGE_NOT_SUPPORTED,
00023         {-1,
00024                  "SLP_LANGUAGE_NOT_SUPPORTED",
00025                  "The SLP message was rejected by a remote SLP agent. The API returns this error only when no information was retrieved, and at least one SA or DA indicated a protocol error. The data supplied through the API may be malformed or a may have been damaged in transit."},
00026         {SLP_INVALID_REGISTRATION,
00027                  "SLP_INVALID_REGISTRATION",
00028                  "The API may return this error if an attempt to register a service was rejected by all DAs because of a malformed URL or attributes. SLP does not return the error if at least one DA accepted the registration."}, 
00029         {SLP_AUTHENTICATION_ABSENT,
00030                  "SLP_AUTHENTICATION_ABSENT",
00031                  "The API returns this error if the SA has been configured with net.slp.useScopes value-list of scopes and the SA request did not specify one or more of these allowable scopes, and no others. It may be returned by a DA or SA if the scope included in a request is not supported by the DA or SA."}, 
00032         {SLP_INVALID_UPDATE, 
00033                  "SLP_INVALID_UPDATE", 
00034                  "if the SLP framework supports authentication, this error arises when the UA or SA failed to send an authenticator for requests or registrations in a protected scope."},
00035         {SLP_AUTHENTICATION_FAILED, 
00036                  "SLP_AUTHENTICATION_FAILED", 
00037                  "If the SLP framework supports authentication, this error arises when a authentication on an SLP message failed"},
00038         {SLP_INVALID_UPDATE, 
00039                   "SLP_INVALID_UPDATE", 
00040                   "An update for a non-existing registration was issued, or the update includes a service type or scope different than that in the initial registration, etc."}, 
00041         {SLP_REFRESH_REJECTED, 
00042                   "SLP_REFRESH_REJECTED", 
00043                   "The SA attempted to refresh a registration more frequently than the minimum refresh interval. The SA should call the appropriate API function to obtain the minimum refresh interval to use."},
00044         {SLP_NOT_IMPLEMENTED, 
00045                   "SLP_NOT_IMPLEMENTED", 
00046                   "If an unimplemented feature is used, this error is returned."},
00047         {SLP_BUFFER_OVERFLOW,
00048                   "SLP_BUFFER_OVERFLOW", 
00049                   "An outgoing request overflowed the maximum network MTU size. The request should be reduced in size or broken into pieces and tried again."},
00050         {SLP_NETWORK_TIMED_OUT,
00051                   "SLP_NETWORK_TIMED_OUT", 
00052                   "When no reply can be obtained in the time specified by the configured timeout interval for a unicast request, this error is returned."},
00053         {SLP_NETWORK_INIT_FAILED, 
00054                   "SLP_NETWORK_INIT_FAILED", 
00055                   "If the network cannot initialize properly, this error is returned. Will also be returned if an SA or DA agent (slpd) can not be contacted. See SLPReg() and SLPDeReg() for more information."},
00056         {SLP_MEMORY_ALLOC_FAILED, 
00057                   "SLP_MEMORY_ALLOC_FAILED", 
00058                   "Out of memory error"},
00059         {SLP_PARAMETER_BAD, 
00060                   "SLP_PARAMETER_BAD", 
00061                   "If a parameter passed into a function is bad, this error is returned."},
00062         {SLP_NETWORK_ERROR, 
00063                   "SLP_NETWORK_ERROR ", 
00064                   "The failure of networking during normal operations causes this error to be returned."},
00065         {SLP_INTERNAL_SYSTEM_ERROR, 
00066                   "SLP_INTERNAL_SYSTEM_ERROR", 
00067                   "A basic failure of the API causes this error to be returned. This occurs when a system call or library fails. The operation could not recover."},
00068         {SLP_HANDLE_IN_USE, 
00069                   "SLP_HANDLE_IN_USE", 
00070                   "In the C API, callback functions are not permitted to recursively call into the API on the same SLPHandle, either directly or indirectly. If an attempt is made to do so, this error is returned from the called API function."},
00071         {SLP_TYPE_ERROR, 
00072                   "SLP_TYPE_ERROR", 
00073                   "If the API supports type checking of registrations against service type templates, this error can arise if the attributes in a registration do not match the service type template for the service."},
00074 };
00075 
00076 /* These strings are returned if the error code is not found. */
00077 #define UNKNOWN_ERROR_LABEL                     "Unknown"
00078 #define UNKNOWN_ERROR_DESCRIPTION       "Undefined error code."
00079 
00080 /*=========================================================================*/
00081 /* Returns data in the parameter variables about the error code            */
00082 /*                                                                         */
00083 /* errorNumber -        Error code received.                                   */
00084 /*                                                                         */
00085 /* errorName -          Name of the error code.                                */
00086 /*                                                                         */
00087 /* errorDescription -           A long winded description about the error.     */
00088 /*                                                                         */
00089 /* Returns -            Nothing.                                               */
00090 /*                                                                         */
00091 /* Comment -            This returns (char *) (const) pointers to the strings  */
00092 /*                                      which means that deletion of the strings is un-neces-  */
00093 /*                                      ary.                                                   */
00094 /*=========================================================================*/
00095 void get_full_error_data(int error_number,
00096                          char **error_name,
00097                          char **error_description)
00098 {
00099         int             i;
00100         int             num_entires;
00101 
00102         /* Determine the number of entries in the error code array. */
00103         num_entires = sizeof(error_entries) / sizeof(SLPErrorEntry);
00104         for (i = 0; i < num_entires; i++)
00105         {
00106                 if (error_entries[i].error_number == error_number)
00107                 {
00108                         *error_name = (error_entries[i].label);
00109                         *error_description = (error_entries[i].description);
00110                         return;
00111                 } /* End If. */
00112         } /* End For. */
00113         *error_name = UNKNOWN_ERROR_LABEL;
00114         *error_description = UNKNOWN_ERROR_DESCRIPTION;
00115 } /* End getFullErrorData(int, char *, char *). */
00116 
00117 YCPBoolean check_error_state(int err, char *location_text)
00118 {
00119     char                *error_name;
00120     char                *error_description;
00121 
00122     if (err != SLP_OK)
00123     {
00124         get_full_error_data(err, &error_name, &error_description);
00125         y2error ("%s (%d): %s => %s",
00126             location_text, err, error_name, error_description);
00127         return YCPBoolean(false);
00128     } /* End If. */
00129         return YCPBoolean(true);
00130 }
00131 

Generated on Tue Jan 4 17:02:20 2005 for yast2-slp by doxygen 1.3.6