mw_srvc_dir.h File Reference
`#include <glib.h>`

Go to the source code of this file.

## Data Structures

struct | mwDirectoryHandler
| handles asynchronous events for a directory service instance More...
struct | mwDirectoryMember

## Macros

#define | DIR_SEARCH_ERROR 0x00000000
| return value of directory searches that fail
#define | MW_DIRECTORY_IS_NEW(dir)
#define | MW_DIRECTORY_IS_OPEN(dir)
#define | MW_DIRECTORY_IS_PENDING(dir)
#define | MW_DIRECTORY_IS_STATE(dir, state)
#define | SERVICE_DIRECTORY 0x0000001a

## Typedefs

typedef void(* | mwSearchHandler) (struct mwDirectory *dir, guint32 code, guint32 offset, GList *members)
| Appropriate function signature for handling directory search results.

## Enumerations

enum | mwDirectoryMemberType { mwDirectoryMember_USER = 0x0000 , mwDirectoryMember_GROUP = 0x0001 }
enum | mwDirectoryState { mwDirectory_NEW , mwDirectory_PENDING , mwDirectory_OPEN , mwDirectory_ERROR , mwDirectory_UNKNOWN }

## Functions

GList * | mwAddressBook_getDirectories (struct mwAddressBook *book)
| list of directories associated with address book.
const char * | mwAddressBook_getName (struct mwAddressBook *book)
| the name of the address book
int | mwDirectory_destroy (struct mwDirectory *dir)
| close and free the directory, and unassociate it with its owning address book and service
struct mwAddressBook * | mwDirectory_getAddressBook (struct mwDirectory *dir)
| reference owning address book
gpointer | mwDirectory_getClientData (struct mwDirectory *dir)
| reference associated client data
struct mwServiceDirectory * | mwDirectory_getService (struct mwDirectory *dir)
| reference owning service
enum mwDirectoryState | mwDirectory_getState (struct mwDirectory *dir)
struct mwDirectory * | mwDirectory_new (struct mwAddressBook *book)
| allocate a new directory based off the given address book
int | mwDirectory_next (struct mwDirectory *dir)
| continue a search into its next results
int | mwDirectory_open (struct mwDirectory *dir, mwSearchHandler cb)
| initialize a directory.
int | mwDirectory_previous (struct mwDirectory *dir)
| continue a search into its previous results
void | mwDirectory_removeClientData (struct mwDirectory *dir)
| remove and cleanup user data
int | mwDirectory_search (struct mwDirectory *dir, const char *query)
| initiate a search on an open directory
void | mwDirectory_setClientData (struct mwDirectory *dir, gpointer data, GDestroyNotify clear)
| set client data.
GList * | mwServiceDirectory_getAddressBooks (struct mwServiceDirectory *srvc)
| most recent list of address books available in service
GList * | mwServiceDirectory_getDirectories (struct mwServiceDirectory *srvc)
| list of directories in the service
struct mwDirectoryHandler * | mwServiceDirectory_getHandler (struct mwServiceDirectory *srvc)
| the handler associated with the service at its creation
struct mwServiceDirectory * | mwServiceDirectory_new (struct mwSession *session, struct mwDirectoryHandler *handler)
| Allocate a new directory service instance for use with session.
int | mwServiceDirectory_refreshAddressBooks (struct mwServiceDirectory *srvc)
| submit a request to obtain an updated list of address books from service

## Macro Definition Documentation

## DIR_SEARCH_ERROR

#define DIR_SEARCH_ERROR 0x00000000

return value of directory searches that fail

## MW_DIRECTORY_IS_NEW

#define MW_DIRECTORY_IS_NEW | ( |  | dir | ) |

Value:
MW_DIRECTORY_IS_STATE((dir), mwDirectory_NEW)
MW_DIRECTORY_IS_STATE
#define MW_DIRECTORY_IS_STATE(dir, state)
Definition mw_srvc_dir.h:69
mwDirectory_NEW
@ mwDirectory_NEW
directory is created, but not open
Definition mw_srvc_dir.h:57

## MW_DIRECTORY_IS_OPEN

#define MW_DIRECTORY_IS_OPEN | ( |  | dir | ) |

Value:
MW_DIRECTORY_IS_STATE((dir), mwDirectory_OPEN)
mwDirectory_OPEN
@ mwDirectory_OPEN
directory is open
Definition mw_srvc_dir.h:59

## MW_DIRECTORY_IS_PENDING

#define MW_DIRECTORY_IS_PENDING | ( |  | dir | ) |

Value:
MW_DIRECTORY_IS_STATE((dir), mwDirectory_PENDING)
mwDirectory_PENDING
@ mwDirectory_PENDING
directory has in the process of opening
Definition mw_srvc_dir.h:58

## MW_DIRECTORY_IS_STATE

#define MW_DIRECTORY_IS_STATE | ( |  | dir,
|  |  | state )

Value:
(mwDirectory_getState(dir) == (state))
mwDirectory_getState
enum mwDirectoryState mwDirectory_getState(struct mwDirectory *dir)

## SERVICE_DIRECTORY

#define SERVICE_DIRECTORY 0x0000001a

## Typedef Documentation

## mwSearchHandler

typedef void(* mwSearchHandler) (struct mwDirectory *dir, guint32 code, guint32 offset, GList *members)

Appropriate function signature for handling directory search results.

## Enumeration Type Documentation

## mwDirectoryMemberType

enum mwDirectoryMemberType

Enumerator
mwDirectoryMember_USER |
mwDirectoryMember_GROUP |

## mwDirectoryState

enum mwDirectoryState

Enumerator
mwDirectory_NEW | directory is created, but not open
mwDirectory_PENDING | directory has in the process of opening
mwDirectory_OPEN | directory is open
mwDirectory_ERROR | error opening or using directory
mwDirectory_UNKNOWN | error determining directory state

## Function Documentation

## mwAddressBook_getDirectories()

GList * mwAddressBook_getDirectories | ( | struct mwAddressBook * | book | ) |

list of directories associated with address book.

Note that the returned GList will need to be free'd after use

## mwAddressBook_getName()

const char * mwAddressBook_getName | ( | struct mwAddressBook * | book | ) |

the name of the address book

## mwDirectory_destroy()

int mwDirectory_destroy | ( | struct mwDirectory * | dir | ) |

close and free the directory, and unassociate it with its owning address book and service

## mwDirectory_getAddressBook()

struct mwAddressBook * mwDirectory_getAddressBook | ( | struct mwDirectory * | dir | ) |

reference owning address book

## mwDirectory_getClientData()

gpointer mwDirectory_getClientData | ( | struct mwDirectory * | dir | ) |

reference associated client data

## mwDirectory_getService()

struct mwServiceDirectory * mwDirectory_getService | ( | struct mwDirectory * | dir | ) |

reference owning service

## mwDirectory_getState()

enum mwDirectoryState mwDirectory_getState | ( | struct mwDirectory * | dir | ) |

## mwDirectory_new()

struct mwDirectory * mwDirectory_new | ( | struct mwAddressBook * | book | ) |

allocate a new directory based off the given address book

## mwDirectory_next()

int mwDirectory_next | ( | struct mwDirectory * | dir | ) |

continue a search into its next results

## mwDirectory_open()

int mwDirectory_open | ( | struct mwDirectory * | dir,
|  | mwSearchHandler | cb )

initialize a directory.

## mwDirectory_previous()

int mwDirectory_previous | ( | struct mwDirectory * | dir | ) |

continue a search into its previous results

## mwDirectory_removeClientData()

void mwDirectory_removeClientData | ( | struct mwDirectory * | dir | ) |

remove and cleanup user data

## mwDirectory_search()

int mwDirectory_search | ( | struct mwDirectory * | dir,
|  | const char * | query )

initiate a search on an open directory

## mwDirectory_setClientData()

void mwDirectory_setClientData | ( | struct mwDirectory * | dir,
|  | gpointer | data,
|  | GDestroyNotify | clear )

set client data.

If there is an existing clear function, it will not be called

## mwServiceDirectory_getAddressBooks()

GList * mwServiceDirectory_getAddressBooks | ( | struct mwServiceDirectory * | srvc | ) |

most recent list of address books available in service

## mwServiceDirectory_getDirectories()

GList * mwServiceDirectory_getDirectories | ( | struct mwServiceDirectory * | srvc | ) |

list of directories in the service

## mwServiceDirectory_getHandler()

struct mwDirectoryHandler * mwServiceDirectory_getHandler | ( | struct mwServiceDirectory * | srvc | ) |

the handler associated with the service at its creation

## mwServiceDirectory_new()

struct mwServiceDirectory * mwServiceDirectory_new | ( | struct mwSession * | session,
|  | struct mwDirectoryHandler * | handler )

Allocate a new directory service instance for use with session.

## mwServiceDirectory_refreshAddressBooks()

int mwServiceDirectory_refreshAddressBooks | ( | struct mwServiceDirectory * | srvc | ) |

submit a request to obtain an updated list of address books from service