summaryrefslogtreecommitdiffabout
path: root/libetpan/src/low-level/nntp/newsnntp_types.h
blob: 821df46bd86979cdac5fb1322a32be83086e9f25 (plain)
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
/*
 * libEtPan! -- a mail stuff library
 *
 * Copyright (C) 2001, 2005 - DINH Viet Hoa
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 * 3. Neither the name of the libEtPan! project nor the names of its
 *    contributors may be used to endorse or promote products derived
 *    from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 */

/*
 * $Id$
 */

#ifndef NEWSNNTP_TYPES_H

#define NEWSNNTP_TYPES_H

#ifdef __cplusplus
extern "C" {
#endif

#include <inttypes.h>
#include <libetpan/clist.h>

#include <libetpan/mailstream.h>
#include <libetpan/mmapstring.h>

enum {
  NEWSNNTP_NO_ERROR = 0,
  NEWSNNTP_WARNING_REQUEST_AUTHORIZATION_USERNAME,
  NEWSNNTP_WARNING_REQUEST_AUTHORIZATION_PASSWORD,
  NEWSNNTP_ERROR_STREAM,
  NEWSNNTP_ERROR_UNEXPECTED,
  NEWSNNTP_ERROR_NO_NEWSGROUP_SELECTED,
  NEWSNNTP_ERROR_NO_ARTICLE_SELECTED,
  NEWSNNTP_ERROR_INVALID_ARTICLE_NUMBER,
  NEWSNNTP_ERROR_ARTICLE_NOT_FOUND,
  NEWSNNTP_ERROR_UNEXPECTED_RESPONSE,
  NEWSNNTP_ERROR_INVALID_RESPONSE,
  NEWSNNTP_ERROR_NO_SUCH_NEWS_GROUP,
  NEWSNNTP_ERROR_POSTING_NOT_ALLOWED,
  NEWSNNTP_ERROR_POSTING_FAILED,
  NEWSNNTP_ERROR_PROGRAM_ERROR,
  NEWSNNTP_ERROR_NO_PERMISSION,
  NEWSNNTP_ERROR_COMMAND_NOT_UNDERSTOOD,
  NEWSNNTP_ERROR_COMMAND_NOT_SUPPORTED,
  NEWSNNTP_ERROR_CONNECTION_REFUSED,
  NEWSNNTP_ERROR_MEMORY,
  NEWSNNTP_ERROR_AUTHENTICATION_REJECTED,
  NEWSNNTP_ERROR_BAD_STATE,
};

struct newsnntp
{
  mailstream * nntp_stream;

  int nntp_readonly;

  uint32_t nntp_progr_rate;
  progress_function * nntp_progr_fun;
  
  MMAPString * nntp_stream_buffer;
  MMAPString * nntp_response_buffer;

  char * nntp_response;
};

typedef struct newsnntp newsnntp;

struct newsnntp_group_info
{
  char * grp_name;
  uint32_t grp_first;
  uint32_t grp_last;
  uint32_t grp_count;
  char grp_type;
};

struct newsnntp_group_time {
  char * grp_name;
  uint32_t grp_date;
  char * grp_email;
};

struct newsnntp_distrib_value_meaning {
  char * dst_value;
  char * dst_meaning;
};

struct newsnntp_distrib_default_value {
  uint32_t dst_weight;
  char * dst_group_pattern;
  char * dst_value;
};

struct newsnntp_group_description {
  char * grp_name;
  char * grp_description;
};

struct newsnntp_xhdr_resp_item {
  uint32_t hdr_article;
  char * hdr_value;
};

struct newsnntp_xover_resp_item {
  uint32_t ovr_article;
  char * ovr_subject;
  char * ovr_author;
  char * ovr_date;
  char * ovr_message_id;
  char * ovr_references;
  size_t ovr_size;
  uint32_t ovr_line_count;
  clist * ovr_others;
};

#ifdef __cplusplus
}
#endif

#endif