
The Gopher functions described in this section control the creation and use of the Internet Gopher utilities.
| GopherAttributeEnumerator |
| GopherCreateLocator |
| GopherFindFirstFile |
| GopherGetAttribute |
| GopherGetLocatorType |
| GopherOpenFile |
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.
BOOL GopherCreateLocator(
IN LPCSTR lpszHost,
IN INTERNET_PORT nServerPort,
IN LPCSTR lpszDisplayString,
IN LPCSTR lpszSelectorString,
IN DWORD dwGopherType,
OUT LPCSTR lpszLocator,
IN OUT LPDWORD lpdwBufferLength
);
Creates a Gopher or Gopher+ locator string from its component parts.
| GOPHER_TYPE_ASK | Ask+ item. |
| GOPHER_TYPE_BINARY | Binary file. |
| GOPHER_TYPE_BITMAP | Bitmap file. |
| GOPHER_TYPE_CALENDAR | Calendar file. |
| GOPHER_TYPE_CSO | CSO telephone book server. |
| GOPHER_TYPE_DIRECTORY | Directory of additional Gopher items. |
| GOPHER_TYPE_DOS_ARCHIVE | MS-DOS® archive file. |
| GOPHER_TYPE_ERROR | Indicator of an error condition. |
| GOPHER_TYPE_GIF | GIF graphics file. |
| GOPHER_TYPE_GOPHER_PLUS | Gopher+ item. |
| GOPHER_TYPE_HTML | HTML document. |
| GOPHER_TYPE_IMAGE | Image file. |
| GOPHER_TYPE_INDEX_SERVER | Index server. |
| GOPHER_TYPE_INLINE | Inline file. |
| GOPHER_TYPE_MAC_BINHEX | Macintosh file in BINHEX format. |
| GOPHER_TYPE_MOVIE | Movie file. |
| GOPHER_TYPE_PDF | PDF file. |
| GOPHER_TYPE_REDUNDANT | Indicator of 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_SOUND | Sound file. |
| GOPHER_TYPE_TELNET | Telnet server. |
| GOPHER_TYPE_TEXT_FILE | ASCII text file. |
| GOPHER_TYPE_TN3270 | TN3270 server. |
| GOPHER_TYPE_UNIX_UUENCODED | UUENCODED file. |
| GOPHER_TYPE_UNKNOWN | Item type is unknown. |
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.
HINTERNET GopherFindFirstFile(
IN HINTERNET hGopherSession,
IN LPCSTR lpszLocator,
IN LPCSTR lpszSearchString,
OUT LPGOPHER_FIND_DATA lpFindData,
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.
GopherFindFirstFile closely resembles the Win32 FindFirstFile function. 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 as closed pending. Any open sessions are terminated, and any data waiting for the caller is discarded. In addition, any allocated buffers are freed.
BOOL GopherGetAttribute(
IN HINTERNET hGopherSession,
IN LPCSTR lpszLocator,
IN LPCSTR lpszAttributeName,
OUT LPBYTE lpBuffer,
IN DWORD dwBufferLength,
OUT LPDWORD lpdwCharactersReturned,
IN GOPHER_ATTRIBUTE_ENUMERATOR lpfnEnumerator,
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 value of MIN_GOPHER_ATTRIBUTE_LENGTH (currently defined in Wininet.h as 256 bytes).
BOOL GopherGetLocatorType(
IN LPCSTR lpszLocator,
OUT LPDWORD lpdwGopherType
);
Parses a Gopher locator and determines its attributes.
| GOPHER_TYPE_ASK | Ask+ item. |
| GOPHER_TYPE_BINARY | Binary file. |
| GOPHER_TYPE_BITMAP | Bitmap file. |
| GOPHER_TYPE_CALENDAR | Calendar file. |
| GOPHER_TYPE_CSO | CSO telephone book server. |
| GOPHER_TYPE_DIRECTORY | Directory of additional Gopher items. |
| GOPHER_TYPE_DOS_ARCHIVE | MS-DOS archive file. |
| GOPHER_TYPE_ERROR | Indicator of an error condition. |
| GOPHER_TYPE_GIF | GIF graphics file. |
| GOPHER_TYPE_GOPHER_PLUS | Gopher+ item. |
| GOPHER_TYPE_HTML | HTML document. |
| GOPHER_TYPE_IMAGE | Image file. |
| GOPHER_TYPE_INDEX_SERVER | Index server. |
| GOPHER_TYPE_INLINE | Inline file. |
| GOPHER_TYPE_MAC_BINHEX | Macintosh file in BINHEX format. |
| GOPHER_TYPE_MOVIE | Movie file. |
| GOPHER_TYPE_PDF | PDF file. |
| GOPHER_TYPE_REDUNDANT | Indicator of 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_SOUND | Sound file. |
| GOPHER_TYPE_TELNET | Telnet server. |
| GOPHER_TYPE_TEXT_FILE | ASCII text file. |
| GOPHER_TYPE_TN3270 | TN3270 server. |
| GOPHER_TYPE_UNIX_UUENCODED | UUENCODED file. |
| GOPHER_TYPE_UNKNOWN | Item type is unknown. |
GopherGetLocatorType 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 GopherOpenFile(
IN HINTERNET hGopherSession,
IN LPCSTR lpszLocator,
IN LPCSTR lpszView,
IN DWORD dwFlags,
IN DWORD dwContext
);
Begins reading a Gopher data file from a Gopher server.
GopherOpenFile opens a file at a Gopher server. Because a file cannot actually be 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 as 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 InternetOpenUrl
© 1997 Microsoft Corporation. All rights reserved. Terms of Use.