nntp.h
1 #ifndef NNTP_H
2 #define NNTP_H 1
3 
4 /* ========================================================================== */
5 /* Include files */
6 
7 #include <sys/types.h>
8 #include <limits.h>
9 
10 
11 /*! \addtogroup NNTP */
12 /*! @{ */
13 
14 
15 /* ========================================================================== */
16 /* Data types */
17 
18 /*! \brief Article number
19  *
20  * RFC 3977 requires at least 31 bit storage for article numbers.
21  * The constant \ref NNTP_ANUM_T_MAX must be set to the maximum value that
22  * is supported by this implementation.
23  * According to RFC 3977, article number zero is reserved.
24  *
25  * \attention
26  * This must always be an unsigned integer type.
27  */
28 typedef unsigned long int nntp_anum_t;
29 
30 /*! \brief NNTP group descriptor */
32 {
33  char* name; /*!< Group name */
34  nntp_anum_t eac; /*!< Estimated article count */
35  nntp_anum_t lwm; /*!< Low water mark */
36  nntp_anum_t hwm; /*!< High water mark */
37  unsigned int flags; /*!< Flags (use \c NNTP_GROUP_xxx constants) */
38 };
39 
40 /*! \brief NNTP group label (description string) */
42 {
43  char* name; /*!< Group name */
44  char* label; /*!< Additonal group information */
45 };
46 
47 
48 /* ========================================================================== */
49 /* Constants */
50 
51 /*! \brief Maximum value this implementation supports for \ref nntp_anum_t */
52 #define NNTP_ANUM_T_MAX ULONG_MAX
53 
54 /*! \name Connection closing flags */
55 /*! @{ */
56 /*! Don't send quit command before closing connection to server */
57 #define NNTP_CLOSE_NOQUIT 1U
58 /*! @} */
59 
60 /*! \name Newsgroup flags */
61 /*! @{ */
62 /*! Group name contains only printable ASCII characters */
63 #define NNTP_GROUP_FLAG_ASCII 0x01U
64 /*! Posting to group is allowed */
65 #define NNTP_GROUP_FLAG_PA 0x02U
66 /*! @} */
67 
68 
69 /*! @} */
70 
71 
72 /* ========================================================================== */
73 /* Function prototypes */
74 
75 int nntp_open(int*, const char*, const char*, const char*, int, int, ...);
76 void nntp_close(int*, unsigned int);
78 int nntp_get_motd(int, char**, size_t*);
79 int nntp_get_distrib_pats(int, const char**, size_t*);
81 int nntp_get_subscriptions(int, char**, size_t*);
83 int nntp_get_grouplist(int, size_t*, struct nntp_groupdesc**);
84 int nntp_get_group_labels(int, size_t*, struct nntp_grouplabel**);
85 int nntp_set_group(int, const char*, struct nntp_groupdesc**);
86 int nntp_get_capa_over(int);
87 int nntp_get_over_newsgroups_index(int, size_t*);
88 int nntp_get_overview(int, nntp_anum_t, nntp_anum_t, char**, size_t*);
89 int nntp_get_article_by_mid(int, const char*, char**, size_t*);
90 int nntp_get_article(int, const nntp_anum_t*, char**, size_t*);
91 int nntp_get_article_header(int, const nntp_anum_t*, char**, size_t*);
92 int nntp_get_article_body(int, const nntp_anum_t*, char**, size_t*);
93 int nntp_post_article(int, const char*);
94 
95 
96 #endif /* NNTP_H */
97 
98 /* EOF */
nntp_post_article
int nntp_post_article(int, const char *)
Post article.
Definition: nntp.c:3591
nntp_get_capa_over
int nntp_get_capa_over(int)
Get overview capability of NNTP server.
Definition: nntp.c:3279
nntp_get_motd
int nntp_get_motd(int, char **, size_t *)
Get message of the day.
Definition: nntp.c:2448
nntp_grouplabel::label
char * label
Definition: nntp.h:44
nntp_get_article_header
int nntp_get_article_header(int, const nntp_anum_t *, char **, size_t *)
Get article header.
Definition: nntp.c:3494
nntp_groupdesc::name
char * name
Definition: nntp.h:33
nntp_grouplabel::name
char * name
Definition: nntp.h:43
nntp_get_capa_list_motd
int nntp_get_capa_list_motd(int)
Get message of the day capability of NNTP server.
Definition: nntp.c:2416
nntp_groupdesc::eac
nntp_anum_t eac
Definition: nntp.h:34
nntp_grouplabel
NNTP group label (description string)
Definition: nntp.h:41
nntp_groupdesc
NNTP group descriptor.
Definition: nntp.h:31
nntp_get_capa_list_subscriptions
int nntp_get_capa_list_subscriptions(int)
Get message of the day capability of NNTP server.
Definition: nntp.c:2550
nntp_group_descriptor_constructor
struct nntp_groupdesc * nntp_group_descriptor_constructor(const char *)
Allocate and initialize a descriptor for group.
Definition: nntp.c:2638
nntp_groupdesc::lwm
nntp_anum_t lwm
Definition: nntp.h:35
nntp_open
int nntp_open(int *, const char *, const char *, const char *, int, int,...)
Open connection to NNTP server.
Definition: nntp.c:2070
nntp_get_group_labels
int nntp_get_group_labels(int, size_t *, struct nntp_grouplabel **)
Get additional group information.
Definition: nntp.c:2937
nntp_get_article
int nntp_get_article(int, const nntp_anum_t *, char **, size_t *)
Get complete article.
Definition: nntp.c:3444
nntp_set_group
int nntp_set_group(int, const char *, struct nntp_groupdesc **)
Set current group.
Definition: nntp.c:3124
nntp_get_overview
int nntp_get_overview(int, nntp_anum_t, nntp_anum_t, char **, size_t *)
Get overview for article range.
Definition: nntp.c:3344
nntp_get_grouplist
int nntp_get_grouplist(int, size_t *, struct nntp_groupdesc **)
Get group list.
Definition: nntp.c:2683
nntp_get_article_body
int nntp_get_article_body(int, const nntp_anum_t *, char **, size_t *)
Get article body.
Definition: nntp.c:3544
nntp_groupdesc::hwm
nntp_anum_t hwm
Definition: nntp.h:36
nntp_groupdesc::flags
unsigned int flags
Definition: nntp.h:37
nntp_close
void nntp_close(int *, unsigned int)
Disconnect from NNTP server.
Definition: nntp.c:2348
nntp_get_distrib_pats
int nntp_get_distrib_pats(int, const char **, size_t *)
Get distribution patterns.
Definition: nntp.c:2511
nntp_get_over_newsgroups_index
int nntp_get_over_newsgroups_index(int, size_t *)
Get index of Newsgroups header field in overview.
Definition: nntp.c:3310
nntp_anum_t
unsigned long int nntp_anum_t
Article number.
Definition: nntp.h:28
nntp_get_article_by_mid
int nntp_get_article_by_mid(int, const char *, char **, size_t *)
Get complete article via Message-ID.
Definition: nntp.c:3394
nntp_get_subscriptions
int nntp_get_subscriptions(int, char **, size_t *)
Get subscription proposals.
Definition: nntp.c:2585

Generated at 2024-04-27 using  doxygen