#include <winsock2.h>
#include <bthdef.h>
#include <Bthsdpdef.h>
#include <BluetoothAPIs.h>
#include <Ws2bth.h>
#include <stdio.h>
#include <strsafe.h>
#include "obex.h"
#include "obex_util.h"
#include "parseOpts.h"
#include "libxml/parser.h"
#include "libxml/tree.h"
#include "libxml/xmlstring.h"
Go to the source code of this file.
Data Structures | |
struct | _Listing |
struct | _OppToolContext |
Defines | |
#define | OPPTOOL_EXIT_ERROR_ALLOC -2 |
#define | OPPTOOL_EXIT_ERROR_BT_CONNECTION -4 |
#define | OPPTOOL_EXIT_ERROR_BT_SESSION -5 |
#define | OPPTOOL_EXIT_ERROR_GENERIC -1 |
#define | OPPTOOL_EXIT_ERROR_INTERNAL_PARAM -6 |
#define | OPPTOOL_EXIT_ERROR_OPTIONS -3 |
#define | OPPTOOL_EXIT_SUCCESS 0 |
#define | OPPTOOL_MAX_STD_FILENAME 50 |
Typedefs | |
typedef _Listing | Listing |
typedef _OppToolContext | OppToolContext |
Enumerations | |
enum | OppToolOperationMode { OPPTOOL_OPERATION_MODE_UNKNOWN = 0, OPPTOOL_OPERATION_MODE_PULL_FILES = 1, OPPTOOL_OPERATION_MODE_PULL_ALL, OPPTOOL_OPERATION_MODE_PULL_STD, OPPTOOL_OPERATION_MODE_PULL_VCARD, OPPTOOL_OPERATION_MODE_PUSH_FILES, OPPTOOL_OPERATION_MODE_PUSH_DIRECTORY } |
Functions | |
void | appendListing (Listing *list, wchar_t *item) |
append listing | |
BOOL | authenticationFunction (LPVOID *param, BLUETOOTH_DEVICE_INFO *bdi) |
callback function for authenticating remote device | |
void | cleanupOppToolContext (OppToolContext *oppToolContext) |
Cleanup the opptool context. | |
void | clearListing (Listing *list) |
clear listing | |
int | createFileAndFolderListing (xmlDoc *document, Listing *fileListing, Listing *folderListing) |
create listing from folder-listing xml document | |
int | createFileListing (Listing *fileListing, char *fileString) |
list filenames from --files commandline parameter | |
int | createFileListingFromDirectory (Listing *fileListing, wchar_t *directory, int *files, int *folders) |
create listing from local directory | |
int | createFileListingFromSubDirectory (Listing *fileListing, wchar_t *directory, int *files, int *folders) |
create listing from local sub directory | |
int | createPathListing (Listing *folderListing, wchar_t *path) |
create list of path folders and filename | |
BOOL | CtrlHandler (DWORD fdwCtrlType) |
close program when CTRL-C pressed | |
const char * | ErrorMessage (int error) |
Converts integer type return value to corresponding literal error string. | |
const wchar_t * | ErrorMessageW (int error) |
void | printHelp (void) |
Print help text. | |
int | pullAllFolder (ObexSession *session, wchar_t *remoteFolder, wchar_t *lastFolder, wchar_t *fullRemoteFolder) |
pulls all files from remote folder | |
int | pushAllFolder (OppToolContext *oppToolContext) |
Push all files from input direcory. | |
int | validateProgramParameters (OppToolContext *oppToolContext) |
Validates and processes commandline parameters. |
typedef struct _OppToolContext OppToolContext |
Structure for opptool context, filled in validateProgramParameters function
enum OppToolOperationMode |
void appendListing | ( | Listing * | list, | |
wchar_t * | item | |||
) |
append listing
Append new entry to the end of the listing.
list | - Pointer to the listing to add the entry | |
item | - Pointer to the string |
BOOL authenticationFunction | ( | LPVOID * | param, | |
BLUETOOTH_DEVICE_INFO * | bdi | |||
) |
callback function for authenticating remote device
Authentication callback function registered by opptool and called by system when remote device requsts authentication
param | - Parameter from opptool given when registering the callback. | |
bdi | - Pointer to the bluetooth device info specifying the device which requests authentication |
void cleanupOppToolContext | ( | OppToolContext * | oppToolContext | ) |
Cleanup the opptool context.
Cleanup the context. Closes obex session, closes bluetooth connection, clears listings and frees all memory allocated for context.
oppToolContext | - Pointer to the opptool context to be cleared |
void clearListing | ( | Listing * | list | ) |
clear listing
Remove all entries from the listing.
list | - Pointer to the listing to clear |
int createFileAndFolderListing | ( | xmlDoc * | document, | |
Listing * | fileListing, | |||
Listing * | folderListing | |||
) |
create listing from folder-listing xml document
Creates file and folder listing from xml document
document | - Pointer to the xml folder-listing document | |
fileListing | - Pointer to the listing receiving file entries | |
folderListing | - Pointer to the listing receiving folder entries |
int createFileListing | ( | Listing * | fileListing, | |
char * | fileString | |||
) |
list filenames from --files commandline parameter
Creates list of filenames from the opptool --files commandline parameter.
fileListing | - Pointer to the listing receiving the filenames | |
fileString | - Pointer to the string containig the files |
int createFileListingFromDirectory | ( | Listing * | fileListing, | |
wchar_t * | directory, | |||
int * | files, | |||
int * | folders | |||
) |
create listing from local directory
Lists all files and folders from given directory
fileListing | - Pointer to the listing to be filled with the files and folders | |
directory | - Null terminating string specifying the directory | |
files | - Pointer to the variable receiving number of files listed | |
folders | - Pointer to the variable receiving number of folders listed |
int createFileListingFromSubDirectory | ( | Listing * | fileListing, | |
wchar_t * | directory, | |||
int * | files, | |||
int * | folders | |||
) |
create listing from local sub directory
Recursive function lists all files and folders from given subdirectory
fileListing | - Pointer to the listing to be filled with the files and folders | |
directory | - Null terminating string specifying the directory | |
files | - Pointer to the variable receiving number of files listed | |
folders | - Pointer to the variable receiving number of folders listed |
int createPathListing | ( | Listing * | folderListing, | |
wchar_t * | path | |||
) |
create list of path folders and filename
Creates list of folders and filename of string that contains full path
folderListing | - Pointer to the listing receiving the folders and filename | |
path | - Pointer to the path containing the folders and filename |
BOOL CtrlHandler | ( | DWORD | fdwCtrlType | ) |
close program when CTRL-C pressed
fdwCtrlType | - interrupt, when something pressed from keyboard |
const char* ErrorMessage | ( | int | error | ) |
Converts integer type return value to corresponding literal error string.
error | - Integer error value |
const wchar_t* ErrorMessageW | ( | int | error | ) |
void printHelp | ( | void | ) |
Print help text.
This function prints the help text to the screen.
int pullAllFolder | ( | ObexSession * | session, | |
wchar_t * | remoteFolder, | |||
wchar_t * | lastFolder, | |||
wchar_t * | fullRemoteFolder | |||
) |
pulls all files from remote folder
Recursive function for pulling all files from remote device
session | - Pointer to the obex session used in the pull operation | |
remoteFolder | - The remote folder name | |
lastFolder | - Parameter containing the full path of the parent folder of remoteFolder | |
fullRemoteFolder | - Full path to the current folder |
int pushAllFolder | ( | OppToolContext * | oppToolContext | ) |
Push all files from input direcory.
Push all files from the directory specified in the opptool in-dir parameter or from program directory.
oppToolContext | - Pointer to the oppToolContext which contains all information for the operation |
int validateProgramParameters | ( | OppToolContext * | oppToolContext | ) |
Validates and processes commandline parameters.
Validates commandline parameters. Checks for conflicts and required parameters. Processes --files parameter and creates listing from --in-dir parameter. Registers authentication callback. Chooses service for connection.
oppToolContext | - Pointer to the opptool context which contains the commandline parameters and receives the processed parameters. |
OPPTOOL_EXIT_ERROR_OPTIONS if commandline parameters are incorrect or processng the parameters fails.