File: tftpd_pcre.h

package info (click to toggle)
atftp 0.7.dfsg-6
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 1,144 kB
  • ctags: 538
  • sloc: ansic: 6,384; sh: 3,892; makefile: 81
file content (73 lines) | stat: -rw-r--r-- 1,825 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/* hey emacs! -*- Mode: C; c-file-style: "k&r"; indent-tabs-mode: nil -*- */
/*
 * tftpd_pcre.h
 *
 * $Id: tftpd_pcre.h,v 1.1 2003/02/21 05:06:06 jp Exp $
 *
 * Copyright (c) 2000 Jean-Pierre Lefebvre <helix@step.polymtl.ca>
 *                and Remi Lefebvre <remi@debian.org>
 *
 * The PCRE code is provided by Jeff Miller <jeff.miller@transact.com.au>
 *
 * Copyright (c) 2003 Jeff Miller <jeff.miller@transact.com.au>
 *
 * atftp is free software; you can redistribute them and/or modify them
 * under the terms of the GNU General Public License as published by the
 * Free Software Foundation; either version 2 of the License, or (at your
 * option) any later version.
 *
 */
#ifndef TFTPD_PCRE_H
#define TFTPD_PCRE_H
#include <pthread.h>
#include <pcre.h>

#include "tftpd.h"

/* Carry out filename substitution
 * example, pattern
 * (name)    sur($1)
 *
 * for the requested file "filename" would give "surname"
 *
 */

/*
 * for when we read files, what is the format of a line
 * pattern [whitespace] replacement_string
 */

#define TFTPD_PCRE_FILE_PATTERN "^(\\S+)\\s+(\\S+)$"

/*
 * Definition of struct to hold patterns
 */

struct tftpd_pcre_pattern
{
     unsigned int linenum;
     char *pattern;
     pcre *left_re;
     pcre_extra *left_pe;
     char *right_str;
     struct tftpd_pcre_pattern *next;
};

typedef struct tftpd_pcre_pattern tftpd_pcre_pattern_t;

struct tftpd_pcre_self
{
     pthread_mutex_t lock;
     char filename[MAXLEN];
     struct tftpd_pcre_pattern *list;
};

typedef struct tftpd_pcre_self tftpd_pcre_self_t;

/* function prototypes */
tftpd_pcre_self_t *tftpd_pcre_open(char *filename);
char *tftpd_pcre_getfilename(tftpd_pcre_self_t *self);
int tftpd_pcre_sub(tftpd_pcre_self_t *self, char *outstr, int outlen, char *str);
void tftpd_pcre_close(tftpd_pcre_self_t *self);

#endif