3.1.4.6 Receiving a SEARCH Message

The SEARCH message is received by the server as part of a LnkSvrMessage request, as defined in section 3.1.4.1.

The server responds to this message by calculating the current FileLocation and MachineID of the requested file.

This message consists of a TRKSVR_CALL_SEARCH structure (defined in section 2.2.12.6), which contains information about the file for which the client is searching. As defined in section 2.2.12.6, the TRKSVR_CALL_SEARCH structure consists of exactly one TRK_FILE_TRACKING_INFORMATION structure (defined in section 2.2.8).

The server MUST attempt to locate the primary entry in the FileTable for the FileLocation specified in this message, as follows:

  • Look for an entry in the FileTable whose PreviousFileLocation field is that of the droidLast field of the TRK_FILE_TRACKING_INFORMATION structure in the message.

  • If that entry is not found, look for an entry in the FileTable whose PreviousFileLocation field is that of the droidBirth field of the TRK_FILE_TRACKING_INFORMATION structure in the message.

If no entry in the FileTable can be found in this way, the server MUST set the hr field in the TRK_FILE_TRACKING_INFORMATION structure to a failure value, and MUST NOT perform further processing for this message.

Using the FileLocation for this entry, the server MUST check for an entry in the FileTable whose PreviousFileLocation is equal to that FileLocation. If such an entry is found, the server MUST repeat this step using that entry's FileLocation. This process MUST continue until no such subsequent entry is found.

For example, if the first entry found indicates that the file was moved from PreviousFileLocation A to FileLocation B, there might be another entry in the FileTable indicating that the file was moved from PreviousFileLocation B to FileLocation C. The preceding steps result in the server finding the entry with PreviousFileLocation of B, which represents the second move in this example.

Given this final FileLocation value (the FileLocation field of the last entry of C, found in the preceding example), the server MUST search for the entry in the ServerVolumeTable whose VolumeID field is equal to the VolumeID component of that FileLocation. (As defined in section 1.1, a FileLocation value has an embedded VolumeID value.) If found:

  • The server MUST set the value of the VolumeOwner field of that entry into the mcidLast field of the TRK_FILE_TRACKING_INFORMATION request structure.

  • The server MUST set the value of the final FileLocation into the droidLast field of the TRK_FILE_TRACKING_INFORMATION request structure.

  • The server MUST set the hr field of the TRK_FILE_TRACKING_INFORMATION request structure to zero.