NWSMTSScanTargetServiceName

Retrieve a Target Service name from a connected TSA.

Syntax

  #include <smsutapi.h> 
  #include <smstsapi.h> 
   
  CCODE NWSMTSScanTargetServiceName (
     UINT32   connection, 
     UINT32  *tsnSequence, 
     STRING   scanPattern, 
     STRING   serviceName);
  

Parameters

connection

(IN) Specifies the connection information returned by NWSMConnectToTSA.

tsnSequence

(IN/OUT) Points to the Target Service name sequence number.

scanPattern

(IN) Specifies the pattern to search for.

serviceName

(OUT) Specifies the Target Service name.

Return Values

See Section 9.3, Target Service Return Values for more information.

The following table lists the return values associated with the function.

0x00000000

Successful

0xFFFDFFB9

NWSMTS_UNSUPPORTED_FUNCTION

0xFFFDFFD2

NWSMTS_NO_MORE_DATA

0xFFFEFFFF

NWSMDR_INVALID_CONNECTION

0xFFFEFFFE

NWSMDR_INVALID_PARAMETER

Remarks

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.

Value

Description

“*”

Return all names

“*xxxx”

Return all names that end with “xxxx” a

“xxxx*”

Return all names that begin with “xxxx”a

“xxxx”

Find name “xxxx”a

a. Where "xxxx" is one or more characters.

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.

See Also

NWSMTSConnectToTargetService, NWSMTSConnectToTargetServiceEx, NWSMTSGetTargetServiceType, NWSMTSListTargetServices

Example

  #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*/