#ifndef EL__PROTOCOL_NNTP_CONNECTION_H #define EL__PROTOCOL_NNTP_CONNECTION_H #include "protocol/nntp/codes.h" #include "protocol/protocol.h" #include "util/string.h" /* An NNTP target is a mapping from a given URI which in short form tells what * the URI describes. Using the following tokens: * * the name of the newsgroup * @ * a numeric id of the article within the group * - * * The nntp:// URI syntax is resolved like this: * * nntp:/// - NNTP_TARGET_GROUPS * nntp:/// - NNTP_TARGET_MESSAGE_ID * nntp:/// - NNTP_TARGET_GROUP * nntp://// - NNTP_TARGET_GROUP * nntp://// - NNTP_TARGET_ARTICLE_NUMBER * nntp://// - NNTP_TARGET_ARTICLE_RANGE * nntp://// - NNTP_TARGET_GROUP_MESSAGE_ID */ /* NNTP targets */ enum nntp_target { NNTP_TARGET_GROUPS, /* List groups available */ NNTP_TARGET_MESSAGE_ID, /* Get */ NNTP_TARGET_GROUP, /* List messages in */ NNTP_TARGET_ARTICLE_NUMBER, /* Get from */ NNTP_TARGET_ARTICLE_RANGE, /* Get from */ NNTP_TARGET_GROUP_MESSAGE_ID, /* Get from */ NNTP_TARGET_QUIT, /* Special target for shutting down */ }; /* NNTP command identifiers */ enum nntp_command { NNTP_COMMAND_NONE, /* No command currently in progress */ NNTP_COMMAND_QUIT, /* QUIT */ NNTP_COMMAND_GROUP, /* GROUP */ NNTP_COMMAND_ARTICLE_NUMBER, /* ARTICLE */ NNTP_COMMAND_ARTICLE_MESSAGE_ID,/* ARTICLE */ NNTP_COMMAND_LIST_NEWSGROUPS, /* LIST NEWSGROUP */ NNTP_COMMAND_LIST_ARTICLES, /* XOVER or HEAD for each article */ }; /* This stores info about an active NNTP connection */ struct nntp_connection_info { /* The target denotes what is the purpose of the connection. What * should be requested from the server. */ enum nntp_target target; /* There's quite a few callbacks involved in requesting the target so * to figure out whazzup the ``id'' of the current running command is * saved. */ enum nntp_command command; /* The current NNTP status or response code received from the server */ enum nntp_code code; /* Strings pointing into the connection URI. They caches info useful * for requesting the target. */ /* The or undefined if target is NNTP_TARGET_GROUPS */ struct string group; /* Can contain either , or * or undefined if target is NTTP_TARGET_{GROUP,GROUPS}. */ /* For it contains start and end numbers as well as the * separating '-'. */ struct string message; /* State for getting articles in a or an */ long current_article, end_article, articles; /* When listing articles in a using the XOVER command is * preferred however not all news servers support XOVER so ... */ unsigned int xover_unsupported:1; }; #ifdef CONFIG_NNTP extern protocol_handler_T nntp_protocol_handler; extern protocol_handler_T news_protocol_handler; #else #define nntp_protocol_handler NULL #define news_protocol_handler NULL #endif #endif