Open Files 5.3.0
Multi-Platform Event-Driven Application Framework
path.h File Reference
#include "ofc/core.h"
#include "ofc/types.h"
#include "ofc/config.h"
#include "ofc/file.h"
Include dependency graph for path.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

#define ofc_path_add_map   ofc_path_add_mapA
 
#define ofc_path_create   ofc_path_createA
 
#define ofc_path_print   ofc_path_printA
 
#define ofc_path_make_url   ofc_path_make_urlA
 
#define ofc_path_map   ofc_path_mapA
 
#define ofc_path_delete_map   ofc_path_delete_mapA
 
#define ofc_path_map_device   ofc_path_map_deviceA
 
#define ofc_path_update_credentials   ofc_path_update_credentialsA
 
#define ofc_path_get_root   ofc_path_get_rootA
 
typedef OFC_VOID OFC_PATH
 
OFC_CORE_LIB OFC_VOID ofc_path_init (OFC_VOID)
 
OFC_CORE_LIB OFC_VOID ofc_path_destroy (OFC_VOID)
 
OFC_CORE_LIB OFC_BOOL ofc_path_add_mapW (OFC_LPCTSTR lpDevice, OFC_LPCTSTR lpDesc, OFC_PATH *map, OFC_FST_TYPE fsType, OFC_BOOL thumbnail)
 
OFC_CORE_LIB OFC_BOOL ofc_path_add_mapA (OFC_LPCSTR lpDevice, OFC_LPCSTR lpDesc, OFC_PATH *map, OFC_FST_TYPE fsType, OFC_BOOL thumbnail)
 
OFC_CORE_LIB OFC_PATHofc_path_createW (OFC_LPCTSTR lpFileName)
 
OFC_CORE_LIB OFC_PATHofc_path_createA (OFC_LPCSTR lpFileName)
 
OFC_CORE_LIB OFC_PATHofc_path_init_path (OFC_VOID)
 
OFC_CORE_LIB OFC_VOID ofc_path_update (OFC_PATH *path, OFC_PATH *map)
 
OFC_CORE_LIB OFC_SIZET ofc_path_printW (OFC_PATH *path, OFC_LPTSTR *filename, OFC_SIZET *rem)
 
OFC_CORE_LIB OFC_SIZET ofc_path_printA (OFC_PATH *path, OFC_LPSTR *filename, OFC_SIZET *rem)
 
OFC_CORE_LIB OFC_TCHARofc_path_print_alloc (OFC_PATH *path)
 
OFC_CORE_LIB OFC_SIZET ofc_path_make_urlW (OFC_LPTSTR *filename, OFC_SIZET *rem, OFC_LPCTSTR username, OFC_LPCTSTR password, OFC_LPCTSTR domain, OFC_LPCTSTR server, OFC_LPCTSTR share, OFC_LPCTSTR path, OFC_LPCTSTR file)
 
OFC_CORE_LIB OFC_SIZET ofc_path_make_urlA (OFC_LPSTR *filename, OFC_SIZET *rem, OFC_LPCSTR username, OFC_LPCSTR password, OFC_LPCSTR domain, OFC_LPCSTR server, OFC_LPCSTR share, OFC_LPCSTR path, OFC_LPCSTR file)
 
OFC_CORE_LIB OFC_VOID ofc_path_delete (OFC_PATH *path)
 
OFC_CORE_LIB OFC_VOID ofc_path_mapW (OFC_LPCTSTR lpFileName, OFC_LPTSTR *lppMappedName, OFC_FST_TYPE *filesystem)
 
OFC_CORE_LIB OFC_VOID ofc_path_mapA (OFC_LPCSTR lpFileName, OFC_LPSTR *lppMappedName, OFC_FST_TYPE *filesystem)
 
OFC_CORE_LIB OFC_VOID ofc_path_delete_mapW (OFC_LPCTSTR lpVirtual)
 
OFC_CORE_LIB OFC_VOID ofc_path_delete_mapA (OFC_LPCSTR lpVirtual)
 
OFC_CORE_LIB OFC_PATHofc_path_map_deviceW (OFC_LPCTSTR lpDevice)
 
OFC_CORE_LIB OFC_PATHofc_path_map_deviceA (OFC_LPCSTR lpDevice)
 
OFC_BOOL ofc_path_is_wild (OFC_LPCTSTR dir)
 

Macro Definition Documentation

◆ ofc_path_add_map

#define ofc_path_add_map   ofc_path_add_mapA

◆ ofc_path_create

#define ofc_path_create   ofc_path_createA

◆ ofc_path_delete_map

#define ofc_path_delete_map   ofc_path_delete_mapA

Delete a map

See also
ofc_path_delete_mapW
ofc_path_delete_mapA
Examples
smbls.c.

◆ ofc_path_get_root

#define ofc_path_get_root   ofc_path_get_rootA

Get the root of a path

See also
ofc_path_get_rootW
ofc_path_get_rootA
Examples
test_file.c.

◆ ofc_path_make_url

#define ofc_path_make_url   ofc_path_make_urlA

Create a URL

See also
ofc_path_make_urlW
ofc_path_make_urlA

◆ ofc_path_map

#define ofc_path_map   ofc_path_mapA

Map through a path

See also
ofc_path_mapW
ofc_path_mapA

◆ ofc_path_map_device

#define ofc_path_map_device   ofc_path_map_deviceA

Map through a device

See also
ofc_path_map_deviceW
ofc_path_map_deviceA

◆ ofc_path_print

#define ofc_path_print   ofc_path_printA

Convert map to string

See also
ofc_path_printW
ofc_path_printA

◆ ofc_path_update_credentials

#define ofc_path_update_credentials   ofc_path_update_credentialsA

Update a path with credentials

See also
ofc_path_update_credentialsW
ofc_path_update_credentialsA
Examples
test_file.c.

Typedef Documentation

◆ OFC_PATH

typedef OFC_VOID OFC_PATH

The Internal Represenation of a Path

This is exposed to users of the Open Files Path API. It may be preferable to hide this structure behind additional APIs

Function Documentation

◆ ofc_path_add_mapA()

OFC_CORE_LIB OFC_BOOL ofc_path_add_mapA ( OFC_LPCSTR  lpDevice,
OFC_LPCSTR  lpDesc,
OFC_PATH map,
OFC_FST_TYPE  fsType,
OFC_BOOL  thumbnail 
)

◆ ofc_path_add_mapW()

OFC_CORE_LIB OFC_BOOL ofc_path_add_mapW ( OFC_LPCTSTR  lpDevice,
OFC_LPCTSTR  lpDesc,
OFC_PATH map,
OFC_FST_TYPE  fsType,
OFC_BOOL  thumbnail 
)

Add a map for a virtual path

Parameters
lpDeviceThe Device Name to use for the path
lpDescA Description for the map
mappath to use for translating virtual path
fsTypeFile System Handler to use for the map
thumbnailDisplay map contents using thumbnails (info only)
Returns
OFC_TRUE if success, OFC_FALSE otherwise

◆ ofc_path_createA()

OFC_CORE_LIB OFC_PATH* ofc_path_createA ( OFC_LPCSTR  lpFileName)

◆ ofc_path_createW()

OFC_CORE_LIB OFC_PATH* ofc_path_createW ( OFC_LPCTSTR  lpFileName)

Create a path structure for a path string

Parameters
lpFileNamepath string
Returns
path structure
Examples
test_path.c.

◆ ofc_path_delete()

OFC_CORE_LIB OFC_VOID ofc_path_delete ( OFC_PATH path)

Delete a path structure

Parameters
pathThe path structure to delete
Examples
test_path.c.

◆ ofc_path_delete_mapA()

OFC_CORE_LIB OFC_VOID ofc_path_delete_mapA ( OFC_LPCSTR  lpVirtual)

◆ ofc_path_delete_mapW()

OFC_CORE_LIB OFC_VOID ofc_path_delete_mapW ( OFC_LPCTSTR  lpVirtual)

Delete a map

Parameters
lpVirtualVirtual path of map to delete

◆ ofc_path_destroy()

OFC_CORE_LIB OFC_VOID ofc_path_destroy ( OFC_VOID  )

Destroy the Open Files Path Mapping

This should only be called by framework_init

◆ ofc_path_init()

OFC_CORE_LIB OFC_VOID ofc_path_init ( OFC_VOID  )

Initialize the Open Files Path Mapping

This should only be called by framework_init

◆ ofc_path_init_path()

OFC_CORE_LIB OFC_PATH* ofc_path_init_path ( OFC_VOID  )

◆ ofc_path_is_wild()

OFC_BOOL ofc_path_is_wild ( OFC_LPCTSTR  dir)

Is directory a wildcard

Parameters
dirpointer to directory
Returns
True if wild

◆ ofc_path_make_urlA()

OFC_CORE_LIB OFC_SIZET ofc_path_make_urlA ( OFC_LPSTR filename,
OFC_SIZET rem,
OFC_LPCSTR  username,
OFC_LPCSTR  password,
OFC_LPCSTR  domain,
OFC_LPCSTR  server,
OFC_LPCSTR  share,
OFC_LPCSTR  path,
OFC_LPCSTR  file 
)

◆ ofc_path_make_urlW()

OFC_CORE_LIB OFC_SIZET ofc_path_make_urlW ( OFC_LPTSTR filename,
OFC_SIZET rem,
OFC_LPCTSTR  username,
OFC_LPCTSTR  password,
OFC_LPCTSTR  domain,
OFC_LPCTSTR  server,
OFC_LPCTSTR  share,
OFC_LPCTSTR  path,
OFC_LPCTSTR  file 
)

Construct a URL suitable for passing into Open File APIs as the remote escaped file name.

This routine will fill in a buffer provided by the application with the URL. Since it is difficult to predict the size of the buffer required to hold the URL, this routine will typically be called twice in a row. The first time it is called, it is called with a "rem" value of 0 and a NULL as the pointer to the buffer. The routine will return the number of characters that would have been put into the string assuming the buffer was big enough (len). The application then then allocate a buffer large enough to hold the URL using the returned number of characters in the URL (len). On the second call to the routine, If the Unicode version of the routine is called, the buffer size should be big enough to hold len + 1 times the sizeof (OFC_TCHAR). If the Ascii version of the routine is called, the buffer size should be big enough to hold len+1 times the size of a character, sizeof (OFC_CHAR). The extra one in this calculation is required if you want the string to be null terminated.

Parameters
filenamePointer to a pointer to the buffer to place URL in. The API specifies a pointer to a pointer so that the routine can update the pointer to the end of the string.
rempointer to the number of remaining characters in the buffer. The API will update this with the remaining characters that can fit in the buffer.
usernamePointer to the username to put in the URL. A NULL pointer will leave the username field empty.
passwordPointer to the password to put in the URL.
domainPointer to the domain to put in the URL
serverPointer to the server to put in the URL
sharePointer to the share to put in the URL
pathPointer to the directory path to put in the URL. Subdirectories should be encoded with the directory terminator ("\\" or "/") between each directory level
fileThe file portion of the URL
Returns
Number of bytes in the URL whether they fit in the output buffer or not. The routine also updates the filename pointer to point to the next location in the buffer to append additional text, and the number of characters remaining in the buffer is also returned.
Examples
smbls.c, and test_path.c.

◆ ofc_path_map_deviceA()

OFC_CORE_LIB OFC_PATH* ofc_path_map_deviceA ( OFC_LPCSTR  lpDevice)

◆ ofc_path_map_deviceW()

OFC_CORE_LIB OFC_PATH* ofc_path_map_deviceW ( OFC_LPCTSTR  lpDevice)

Find a map for a path

Parameters
lpDeviceThe device string
Returns
The map for the path
Examples
test_file.c.

◆ ofc_path_mapA()

OFC_CORE_LIB OFC_VOID ofc_path_mapA ( OFC_LPCSTR  lpFileName,
OFC_LPSTR lppMappedName,
OFC_FST_TYPE *  filesystem 
)
See also
ofc_path_mapW

◆ ofc_path_mapW()

OFC_CORE_LIB OFC_VOID ofc_path_mapW ( OFC_LPCTSTR  lpFileName,
OFC_LPTSTR lppMappedName,
OFC_FST_TYPE *  filesystem 
)

Map a local path to a target path

Parameters
lpFileNameThe local path (virtual path used by applications or CIFS Server)
lppMappedNameThe target path (relative to the target file system type)
filesystemfile system type

◆ ofc_path_print_alloc()

OFC_CORE_LIB OFC_TCHAR* ofc_path_print_alloc ( OFC_PATH path)

Print a wide character path and allocate string

Parameters
pathPath to print
Returns
Wide character string
Note
String must be freed by call to ofc_free
Examples
test_path.c.

◆ ofc_path_printA()

OFC_CORE_LIB OFC_SIZET ofc_path_printA ( OFC_PATH path,
OFC_LPSTR filename,
OFC_SIZET rem 
)
See also
ofc_path_printW

◆ ofc_path_printW()

OFC_CORE_LIB OFC_SIZET ofc_path_printW ( OFC_PATH path,
OFC_LPTSTR filename,
OFC_SIZET rem 
)

Print a path structure to a string

Parameters
pathpath to print
filenamestring to print path to
rempointer to number of bytes available in destination filename This is updated to account for any characters output
Returns
Number of bytes printed
Examples
test_file.c.

◆ ofc_path_update()

OFC_CORE_LIB OFC_VOID ofc_path_update ( OFC_PATH path,
OFC_PATH map 
)

Apply a map to a path

The routine will assentially update the path pointed to by the first argument with info from the map supplied in the second argument. This means that the device, server, credentials, share, and parent directories of the map are simply prepended to the path

Parameters
pathPath that needs to be updated
mapmap to update the path with