/*=========================================================================*/ void FindSrvTypes(SLPToolCommandLine* cmdline) /*=========================================================================*/ { SLPError result; SLPHandle hslp; if(SLPOpen(cmdline->lang,SLP_FALSE,&hslp) == SLP_OK) { if(cmdline->cmdparam1) { result = SLPFindSrvTypes(hslp, cmdline->cmdparam1, cmdline->scopes, mySrvTypeCallback, 0); } else { result = SLPFindSrvTypes(hslp, "*", cmdline->scopes, mySrvTypeCallback, 0); } if(result != SLP_OK) { printf("errorcode: %i\n",result); } SLPClose(hslp); } }
/*-------------------------------------------------------------------------*/ int SlpPerfTest1_slpfindsrvtypes(SLPHandle hslp, SLPList* service_list, double* ave_slpfindattrs, int* count_slpfindattrs) /*-------------------------------------------------------------------------*/ { SLPError errorcode; int found = 0; errorcode = SLPFindSrvTypes(hslp, "*", "", SlpPerfTest1_srvtypecallback, &found); if(errorcode != SLP_OK) { printf("SLPFindSrvTypes(hslp,*, , callback %i) returned %i \n", found, errorcode); printf("This should not happen!\n"); return -1; } if(found <= 0) { printf("Did not find any types on SLPFindSrvTypes(). This is bad\n"); return -1; } return 0; }
int main(int argc, char * argv[]) { SLPError err; SLPError callbackerr; SLPHandle hslp; if (argc != 2) { printf("SLPFindSrvTypes\n Finds a SLP service.\n " "Usage:\n SLPFindSrvTypes\n <naming authority>\n"); return 0; } /* End If. */ err = SLPOpen("en", SLP_FALSE, &hslp); check_error_state(err, "Error opening slp handle."); err = SLPFindSrvTypes(hslp, argv[1], 0, MySLPSrvTypeCallback, &callbackerr); check_error_state(err, "Error getting service type with slp."); /* Now that we're done using slp, close the slp handle */ SLPClose(hslp); return 0; }
//No parameters can be null because they aren't checked. int doTest(SLPHandle hslp, const char * namingAuth, const char* scopelist, const char* testid, void* cookie) { SLPResultCookie* myCookie = (SLPResultCookie*)cookie; int result; result = SLPFindSrvTypes(hslp, namingAuth, scopelist, theSrvtypesCallback, cookie); if ( (myCookie->retval == myCookie->expectedRetval) ) { printf("SLPFindSrvTypes\t(%*s): %10s\n", TEST_TYPE_PADDING, testid, "PASSED"); } else { printf("SLPFindSrvTypes\t(%*s): %12s\n", TEST_TYPE_PADDING, testid, "**FAILED**"); printf("\tReturn Value:\t\t%s\n\tExpected:\t\t%s", errcodeToStr(myCookie->retval), errcodeToStr(myCookie->expectedRetval)); printf("\n\tMessage:\t\t%s\n",myCookie->msg); } return result; }
void FindSrvTypes(SLPToolCommandLine * cmdline) { SLPError result; SLPHandle hslp; if (SLPOpen(cmdline->lang, SLP_FALSE, &hslp) == SLP_OK) { #ifndef UNICAST_NOT_SUPPORTED if (cmdline->unicastifc && (result = SLPAssociateIP(hslp, cmdline->unicastifc)) != SLP_OK) { printf("errorcode: %i\n", result); SLPClose(hslp); return; } #endif #ifndef MI_NOT_SUPPORTED if (cmdline->interfaces && (result = SLPAssociateIFList(hslp, cmdline->interfaces)) != SLP_OK) { printf("errorcode: %i\n", result); SLPClose(hslp); return; } #endif if (cmdline->cmdparam1) result = SLPFindSrvTypes(hslp, cmdline->cmdparam1, cmdline->scopes, mySrvTypeCallback, 0); else result = SLPFindSrvTypes(hslp, "*", cmdline->scopes, mySrvTypeCallback, 0); if (result != SLP_OK) printf("errorcode: %i\n", result); SLPClose(hslp); } }