1997-11-18 15:06:00 +01:00
|
|
|
/* filter.h
|
1998-02-24 19:50:46 +01:00
|
|
|
* Copyright (C) 1998 Free Software Foundation, Inc.
|
1997-11-18 15:06:00 +01:00
|
|
|
*
|
1998-02-24 19:50:46 +01:00
|
|
|
* This file is part of GNUPG.
|
1997-11-18 15:06:00 +01:00
|
|
|
*
|
1998-02-24 19:50:46 +01:00
|
|
|
* GNUPG is free software; you can redistribute it and/or modify
|
1997-11-18 15:06:00 +01:00
|
|
|
* it 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.
|
|
|
|
*
|
1998-02-24 19:50:46 +01:00
|
|
|
* GNUPG is distributed in the hope that it will be useful,
|
1997-11-18 15:06:00 +01:00
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
|
|
|
*/
|
|
|
|
#ifndef G10_FILTER_H
|
|
|
|
#define G10_FILTER_H
|
|
|
|
|
1998-02-18 14:58:46 +01:00
|
|
|
#include "types.h"
|
1997-11-18 15:06:00 +01:00
|
|
|
#include "cipher.h"
|
|
|
|
|
|
|
|
typedef struct {
|
1998-01-12 11:18:17 +01:00
|
|
|
MD_HANDLE md; /* catch all */
|
1997-11-18 15:06:00 +01:00
|
|
|
size_t maxbuf_size;
|
|
|
|
} md_filter_context_t;
|
|
|
|
|
1997-11-21 15:53:57 +01:00
|
|
|
typedef struct {
|
|
|
|
int status;
|
|
|
|
int what;
|
|
|
|
byte radbuf[4];
|
|
|
|
int idx, idx2;
|
|
|
|
u32 crc;
|
1997-12-23 18:30:18 +01:00
|
|
|
byte helpbuf[100];
|
|
|
|
int helpidx, helplen;
|
1998-02-04 19:54:31 +01:00
|
|
|
unsigned empty; /* empty line counter */
|
1998-01-28 17:09:43 +01:00
|
|
|
int faked;
|
|
|
|
int parse_state;
|
1997-11-21 15:53:57 +01:00
|
|
|
int inp_checked; /* set if inp has been checked */
|
|
|
|
int inp_bypass; /* set if the input is not armored */
|
|
|
|
int inp_eof;
|
1998-02-18 14:58:46 +01:00
|
|
|
const char *hdrlines;
|
1997-11-21 15:53:57 +01:00
|
|
|
} armor_filter_context_t;
|
|
|
|
|
1997-11-18 15:06:00 +01:00
|
|
|
|
1997-11-23 16:38:27 +01:00
|
|
|
typedef struct {
|
|
|
|
int status;
|
|
|
|
void *opaque; /* (used for z_stream) */
|
|
|
|
byte *inbuf;
|
|
|
|
unsigned inbufsize;
|
|
|
|
byte *outbuf;
|
|
|
|
unsigned outbufsize;
|
1997-12-12 13:03:58 +01:00
|
|
|
int pgpmode;
|
1997-11-23 16:38:27 +01:00
|
|
|
} compress_filter_context_t;
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
DEK *dek;
|
|
|
|
u32 datalen;
|
1998-04-07 20:16:10 +02:00
|
|
|
CIPHER_HANDLE cipher_hd;
|
1997-11-23 16:38:27 +01:00
|
|
|
int header;
|
|
|
|
} cipher_filter_context_t;
|
|
|
|
|
|
|
|
|
1998-01-02 21:40:10 +01:00
|
|
|
|
1997-12-23 18:30:18 +01:00
|
|
|
typedef struct {
|
|
|
|
int eof;
|
1998-02-04 19:54:31 +01:00
|
|
|
size_t idx;
|
|
|
|
size_t len;
|
|
|
|
byte buf[256];
|
1997-12-23 18:30:18 +01:00
|
|
|
} text_filter_context_t;
|
1997-11-23 16:38:27 +01:00
|
|
|
|
1998-01-02 21:40:10 +01:00
|
|
|
|
|
|
|
/* encrypt_filter_context_t defined in main.h */
|
|
|
|
|
1997-11-18 15:06:00 +01:00
|
|
|
/*-- mdfilter.c --*/
|
|
|
|
int md_filter( void *opaque, int control, IOBUF a, byte *buf, size_t *ret_len);
|
1997-11-24 12:04:11 +01:00
|
|
|
void free_md_filter_context( md_filter_context_t *mfx );
|
1997-11-18 15:06:00 +01:00
|
|
|
|
1997-11-21 15:53:57 +01:00
|
|
|
/*-- armor.c --*/
|
1998-02-16 21:05:02 +01:00
|
|
|
int use_armor_filter( IOBUF a );
|
1997-11-21 15:53:57 +01:00
|
|
|
int armor_filter( void *opaque, int control,
|
|
|
|
IOBUF chain, byte *buf, size_t *ret_len);
|
|
|
|
|
1997-11-23 16:38:27 +01:00
|
|
|
/*-- compress.c --*/
|
|
|
|
int compress_filter( void *opaque, int control,
|
|
|
|
IOBUF chain, byte *buf, size_t *ret_len);
|
|
|
|
|
|
|
|
/*-- cipher.c --*/
|
|
|
|
int cipher_filter( void *opaque, int control,
|
|
|
|
IOBUF chain, byte *buf, size_t *ret_len);
|
|
|
|
|
1997-12-23 18:30:18 +01:00
|
|
|
/*-- textfilter.c --*/
|
|
|
|
int text_filter( void *opaque, int control,
|
|
|
|
IOBUF chain, byte *buf, size_t *ret_len);
|
|
|
|
|
1997-11-23 16:38:27 +01:00
|
|
|
|
|
|
|
|
1997-11-18 15:06:00 +01:00
|
|
|
#endif /*G10_FILTER_H*/
|