Retrieve a Target Service name from a connected TSA.
#include <smsutapi.h> #include <smstsapi.h> CCODE NWSMTSScanTargetServiceName ( UINT32 connection, UINT32 *tsnSequence, STRING scanPattern, STRING serviceName);
(IN) Specifies the connection information returned by NWSMConnectToTSA.
(IN/OUT) Points to the Target Service name sequence number.
(IN) Specifies the pattern to search for.
(OUT) Specifies the Target Service name.
See Section 9.3, Target Service Return Values for more information.
The following table lists the return values associated with the function.
Before NWSMTSScanTargetServiceName is called, the engine must be connected to a TSA.
A TSA can service only one Target Service name or multiple Target Services. NWSMTSScanTargetServiceName must be called repeatedly to retrieve all specified Target Service names. When provided with supporting code, NWSMTSScanTargetServiceName is the same as NWSMTSListTargetServices.
The engine sets tsnSequence to zero before starting each scanning session. If NWSMTSScanTargetServiceName returns an error, tsnSequence is set to 0xFFFFFFFF.
The values that can be set for scanPattern is listed in the following table.
The engine passes a buffer to serviceName that is NWSM_MAX_TARGET_SRVC_NAME_LEN bytes long. A NULL string is returned if no Target Service is found.
NWSMTSConnectToTargetService, NWSMTSConnectToTargetServiceEx, NWSMTSGetTargetServiceType, NWSMTSListTargetServices
#include <smsutapi.h> #include <smstsapi.h> UINT32 tsnSequence = 0; unsigned char pat[2] = “*”, sName[NWSM_MAX_TARGET_SRVC_NAME_LEN]; NWSM_NAME_LIST *serviceNameList = NULL, *name, *last; STRING pattern = pat, serviceName = sName; /* Connect to a TSA-see NWSMConnectToTSA. */ /* Build the Target Service name list (some TSAs can service multiple Target Services). NWSMTSListTargetServices can be used to create this list. */ while (NWSMTSScanTargetServiceName(connection, &tsnSequence, pattern, serviceName) == 0) { name = (NWSM_NAME_LIST *)calloc(1, sizeof(NWSM_NAME_LIST)); name->name = (STRING)calloc(1, NWSM_MAX_TARGET_SRVC_NAME_LEN); strcpy(name->name, serviceName); if (serviceNameList) { last->next = name; last = last->next; } else serviceNameList = last = name; } /* End while */ /* See if we have more than one Target Service */ if (serviceNameList->next) { /* Have the user choose a Target Service. */ } /* Gather the optional information about the Target Service - see NWSMTSGetTargetServiceType. */ /* Connect to the selected Target Service-see NWSMTSConnectTargetService*/