The Gopher functions control the creation and use of the Internet Gopher utilities.
BOOL GopherCreateLocator( IN LPCTSTR lpszHost, IN INTERNET_PORT nServerPort, IN LPCTSTR lpszDisplayString OPTIONAL, IN LPCTSTR lpszSelectorString OPTIONAL, IN DWORD dwGopherType, OUT LPCTSTR lpszLocator OPTIONAL, IN OUT LPDWORD lpdwBufferLength );
Creates a Gopher or Gopher+ locator string from its component parts.
To retrieve information from a Gopher server, an application must first get a Gopher "locator" from the Gopher server.
The locator, which the application should treat as an opaque token, is normally used for calls to the GopherFindFirstFile function to retrieve a specific piece of information.
BOOL GopherGetLocatorType( IN LPCTSTR lpszLocator, OUT LPDWORD lpdwGopherType );
Parses a Gopher locator and determines its attributes.
Value | Meaning |
GOPHER_TYPE_TEXT_FILE | An ASCII text file. |
GOPHER_TYPE_DIRECTORY | A directory of additional Gopher items. |
GOPHER_TYPE_CSO | A CSO telephone book server. |
GOPHER_TYPE_ERROR | Indicates an error condition. |
GOPHER_TYPE_MAC_BINHEX | A Macintosh file in BINHEX format. |
GOPHER_TYPE_DOS_ARCHIVE | An MS-DOS archive file. |
GOPHER_TYPE_UNIX_UUENCODED | A UUENCODED file. |
GOPHER_TYPE_INDEX_SERVER | Refers to an index server. |
GOPHER_TYPE_TELNET | A Telnet Server. |
GOPHER_TYPE_BINARY | A binary file. |
GOPHER_TYPE_REDUNDANT | Refers to a duplicated server. The information contained within is a duplicate of the primary server.
The primary server is defined as the last directory entry that did not have a GOPHER_TYPE_REDUNDANT type. |
GOPHER_TYPE_TN3270 | A TN3270 server. |
GOPHER_TYPE_GIF | A GIF graphics file. |
GOPHER_TYPE_IMAGE | An image file. |
GOPHER_TYPE_BITMAP | A bitmap file. |
GOPHER_TYPE_MOVIE | A movie file. |
GOPHER_TYPE_SOUND | A sound file. |
GOPHER_TYPE_HTML | An HTML document. |
GOPHER_TYPE_PDF | A PDF file. |
GOPHER_TYPE_CALENDAR | A calendar file. |
GOPHER_TYPE_INLINE | An inline file. |
GOPHER_TYPE_UNKNOWN | The item type is unknown. |
GOPHER_TYPE_ASK | An Ask+ item. |
GOPHER_TYPE_GOPHER_PLUS | A Gopher+ item. |
The GopherGetLocatorType function returns information about the item referenced by a Gopher locator. Note that it is possible for multiple attributes to be set on a file. For example, both GOPHER_TYPE_TEXT_FILE and GOPHER_TYPE_GOPHER_PLUS are set for a text file stored on a Gopher+ server.
HINTERNET GopherFindFirstFile( IN HINTERNET hGopherSession, IN LPCTSTR lpszLocator OPTIONAL, IN LPCTSTR lpszSearchString OPTIONAL, OUT LPGOPHER_FIND_DATA lpFindData OPTIONAL, IN DWORD dwFlags, IN DWORD dwContext );
Uses a Gopher locator and some search criteria to create a session with the server and locate the requested documents, binary files, index servers, or directory trees.
The GopherFindFirstFile function closely resembles the Win32 function FindFirstFile. It creates a connection with a Gopher server and then returns a single structure containing information about the first Gopher object referenced by the locator string.
After calling GopherFindFirstFile to retrieve the first Gopher object in an enumeration, an application can use the InternetFindNextFile function to retrieve subsequent Gopher objects.
Use the InternetCloseHandle function to close the handle returned from GopherFindFirstFile. If there are any pending operations described by the handle when the application calls InternetCloseHandle, they are canceled or marked closed pending. Any open sessions are terminated and any data waiting for the caller is discarded. In addition, any allocated buffers are freed.
See also InternetCloseHandle, InternetConnect, InternetFindNextFile
BOOL GopherGetAttribute( IN HINTERNET hGopherSession, IN LPCTSTR lpszLocator, IN LPCTSTR lpszAttributeName OPTIONAL, OUT LPBYTE lpBuffer, IN DWORD dwBufferLength, OUT LPDWORD lpdwCharactersReturned, IN GOPHER_ATTRIBUTE_ENUMERATOR lpfnEnumerator OPTIONAL, IN DWORD dwContext );
Allows an application to retrieve specific attribute information from the server.
Generally, applications call this function after calling GopherFindFirstFile or InternetFindNextFile.
The size of the lpBuffer parameter must be equal to or greater than the MIN_GOPHER_ATTRIBUTE_LENGTH (currently defined in WININET.H as 256 bytes).
See also InternetConnect
BOOL GopherAttributeEnumerator( LPGOPHER_ATTRIBUTE_TYPE lpAttributeInformation, DWORD dwError );
Defines a callback function that processes attribute information from a Gopher server. This callback function is installed by a call to the GopherGetAttribute function.
HINTERNET GopherOpenFile( IN HINTERNET hGopherSession, IN LPCTSTR lpszLocator, IN LPCTSTR lpszView OPTIONAL, IN DWORD dwFlags, IN DWORD dwContext );
Begins reading a Gopher data file from a Gopher server.
This function opens a file at a Gopher server. Because a file cannot be actually opened or locked at a server, this function simply associates location information with a handle that an application can use for file-based operations such as InternetReadFile or GopherGetAttribute.
Use the InternetCloseHandle function to close the handle returned from GopherOpenFile. If there are any pending operations described by the handle when the application calls InternetCloseHandle, they are canceled or marked closed pending. Any open sessions are terminated, and any data waiting for the caller is discarded. In addition, any allocated buffers are freed.
See also GopherFindFirstFile, GopherGetAttribute, InternetCloseHandle, InternetConnect, InternetFindNextFile, InternetOpenUrl, InternetReadFile