ObexFTP  0.24
Macros | Functions
cache.c File Reference

ObexFTP client API caching layer. More...

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <sys/stat.h>
#include <openobex/obex.h>
#include "obexftp.h"
#include "client.h"
#include "object.h"
#include "unicode.h"
#include "cache.h"
#include <common.h>

Macros

#define _GNU_SOURCE
 
#define S_IFDIR   __S_IFDIR
 
#define S_IFREG   __S_IFREG
 
#define FREE_NODE(node)
 

Functions

void cache_purge (cache_object_t **root, const char *path)
 Purge all cache object at/below a given path. More...
 
int get_cache_object (const obexftp_client_t *cli, const char *name, char **object, int *size)
 Retrieve an object from the cache. More...
 
int put_cache_object (obexftp_client_t *cli, char *name, char *object, int size)
 Store an object in the cache. More...
 
void * obexftp_opendir (obexftp_client_t *cli, const char *name)
 Prepare a directory for reading. More...
 
int obexftp_closedir (void *dir)
 Close a directory after reading. More...
 
stat_entry_tobexftp_readdir (void *dir)
 Read the next entry from an open directory. More...
 
stat_entry_tobexftp_stat (obexftp_client_t *cli, const char *name)
 Stat a directory entry. More...
 

Detailed Description

ObexFTP client API caching layer.

ObexFTP library - language bindings for OBEX file transfer.

Copyright (c) 2002-2007 Christian W. Zuckschwerdt zany@.nosp@m.triq.nosp@m..net

ObexFTP is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with ObexFTP. If not, see http://www.gnu.org/.

Macro Definition Documentation

◆ _GNU_SOURCE

#define _GNU_SOURCE

◆ FREE_NODE

#define FREE_NODE (   node)
Value:
do { \
if (node->name) \
free(node->name); \
if (node->content) \
free(node->content); \
if (node->stats) \
free(node->stats); \
free(node); \
} while(0)

◆ S_IFDIR

#define S_IFDIR   __S_IFDIR

◆ S_IFREG

#define S_IFREG   __S_IFREG

Function Documentation

◆ cache_purge()

void cache_purge ( cache_object_t **  root,
const char *  path 
)

Purge all cache object at/below a given path.

Methods that need to invalidate cache lines:

  • setpath (when create is on)
  • put
  • put_file
  • del
  • rename

◆ get_cache_object()

int get_cache_object ( const obexftp_client_t cli,
const char *  name,
char **  object,
int *  size 
)

Retrieve an object from the cache.

◆ obexftp_closedir()

int obexftp_closedir ( void *  dir)

Close a directory after reading.

The stat entry is a cache object so we do nothing.

◆ obexftp_opendir()

void* obexftp_opendir ( obexftp_client_t cli,
const char *  name 
)

Prepare a directory for reading.

◆ obexftp_readdir()

stat_entry_t* obexftp_readdir ( void *  dir)

Read the next entry from an open directory.

◆ obexftp_stat()

stat_entry_t* obexftp_stat ( obexftp_client_t cli,
const char *  name 
)

Stat a directory entry.

◆ put_cache_object()

int put_cache_object ( obexftp_client_t cli,
char *  name,
char *  object,
int  size 
)

Store an object in the cache.