Macros | Enumerations | Functions
nntp.c File Reference

Network News Transfer Protocol. More...

Go to the source code of this file.

Macros

#define MAIN_ERR_PREFIX   "NNTP: "
 Message prefix for NNTP module.
 
#define NNTP_HANDLEMAX   1U
 Maximum number of simultaneous NNTP connections.
 
#define NNTP_LINELENGTHMAX   (size_t) 512
 Maximum line length (for command/response, not payload) More...
 
#define NNTP_ARGLENGTHMAX   (size_t) 497
 NNTP V2 maximum command argument length (according to RFC 3977)
 
NNTP capabilities

The flags can be bitwise ORed together.

#define NNTP_CAPA_MODE_READER   0x0001U
 
#define NNTP_CAPA_READER   0x0002U
 
#define NNTP_CAPA_LIST   0x0004U
 
#define NNTP_CAPA_LIST_MOTD   0x0008U
 
#define NNTP_CAPA_LIST_DISTRIB_PATS   0x0010U
 
#define NNTP_CAPA_LIST_SUBSCRIPTIONS   0x0020U
 
#define NNTP_CAPA_OVER   0x0040U
 
#define NNTP_CAPA_POST   0x0080U
 
#define NNTP_CAPA_AUTHINFO_USER   0x0100U
 
#define NNTP_CAPA_COMPRESS   0x0200U
 
#define NNTP_CAPA_MAXARTNUM   0x0400U
 
Algorithms for NNTP compression extension

The flags can be bitwise ORed together.

#define NNTP_COMPRESS_DEFLATE   0x0001U
 

Enumerations

enum  nntp_cmd {
  NNTP_CMD_INIT, NNTP_CMD_QUIT, NNTP_CMD_CAPABILITIES, NNTP_CMD_MODE_READER,
  NNTP_CMD_MAXARTNUM, NNTP_CMD_COMPRESS, NNTP_CMD_AUTHINFO_USER, NNTP_CMD_AUTHINFO_PASS,
  NNTP_CMD_LIST, NNTP_CMD_LIST_NEWSGROUPS, NNTP_CMD_LIST_MOTD, NNTP_CMD_LIST_DISTRIB_PATS,
  NNTP_CMD_LIST_SUBSCRIPTIONS, NNTP_CMD_LIST_OVERVIEW_FMT, NNTP_CMD_GROUP, NNTP_CMD_OVER,
  NNTP_CMD_ARTICLE_BY_MID, NNTP_CMD_ARTICLE, NNTP_CMD_HEAD, NNTP_CMD_BODY,
  NNTP_CMD_POST
}
 

Functions

int nntp_open (int *handle, const char *servername, const char *service, const char *logfile, int enc, int auth,...)
 Open connection to NNTP server. More...
 
void nntp_close (int *handle, unsigned int flags)
 Disconnect from NNTP server. More...
 
int nntp_get_capa_list_motd (int handle)
 Get message of the day capability of NNTP server. More...
 
int nntp_get_motd (int handle, char **data, size_t *len)
 Get message of the day. More...
 
int nntp_get_distrib_pats (int handle, const char **data, size_t *len)
 Get distribution patterns. More...
 
int nntp_get_capa_list_subscriptions (int handle)
 Get message of the day capability of NNTP server. More...
 
int nntp_get_subscriptions (int handle, char **data, size_t *len)
 Get subscription proposals. More...
 
struct nntp_groupdescnntp_group_descriptor_constructor (const char *name)
 Allocate and initialize a descriptor for group. More...
 
int nntp_get_grouplist (int handle, size_t *groupcount, struct nntp_groupdesc **p)
 Get group list. More...
 
int nntp_get_group_labels (int handle, size_t *groupcount, struct nntp_grouplabel **p)
 Get additional group information. More...
 
int nntp_set_group (int handle, const char *name, struct nntp_groupdesc **gd)
 Set current group. More...
 
int nntp_get_capa_over (int handle)
 Get overview capability of NNTP server. More...
 
int nntp_get_over_newsgroups_index (int handle, size_t *index)
 Get index of Newsgroups header field in overview. More...
 
int nntp_get_overview (int handle, nntp_anum_t first, nntp_anum_t last, char **data, size_t *len)
 Get overview for article range. More...
 
int nntp_get_article_by_mid (int handle, const char *mid, char **article, size_t *len)
 Get complete article via Message-ID. More...
 
int nntp_get_article (int handle, const nntp_anum_t *id, char **article, size_t *len)
 Get complete article. More...
 
int nntp_get_article_header (int handle, const nntp_anum_t *id, char **header, size_t *len)
 Get article header. More...
 
int nntp_get_article_body (int handle, const nntp_anum_t *id, char **body, size_t *len)
 Get article body. More...
 
int nntp_post_article (int handle, const char *article)
 Post article. More...
 

Detailed Description

Network News Transfer Protocol.

Copyright (c) 2012-2023 by the developers. See the LICENSE file for details.

If nothing else is specified, functions return zero to indicate success and a negative value to indicate an error.

Definition in file nntp.c.


Generated at 2024-04-27 using  doxygen