2005-09-15 09:58:31 -04:00
|
|
|
#ifndef EL__PROTOCOL_PROTOCOL_H
|
|
|
|
#define EL__PROTOCOL_PROTOCOL_H
|
|
|
|
|
|
|
|
#include "main/module.h"
|
|
|
|
|
2020-10-05 14:14:55 -04:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2005-09-15 09:58:31 -04:00
|
|
|
struct connection;
|
|
|
|
struct session;
|
|
|
|
struct terminal;
|
|
|
|
struct uri;
|
|
|
|
|
|
|
|
enum protocol {
|
|
|
|
PROTOCOL_ABOUT,
|
|
|
|
PROTOCOL_BITTORRENT,
|
2008-09-06 23:10:52 -04:00
|
|
|
PROTOCOL_BITTORRENT_PEER,
|
2005-09-15 09:58:31 -04:00
|
|
|
PROTOCOL_DATA,
|
2022-05-21 12:17:04 -04:00
|
|
|
PROTOCOL_DGI,
|
2005-09-15 09:58:31 -04:00
|
|
|
PROTOCOL_FILE,
|
|
|
|
PROTOCOL_FINGER,
|
2006-01-16 05:40:13 -05:00
|
|
|
PROTOCOL_FSP,
|
2005-09-15 09:58:31 -04:00
|
|
|
PROTOCOL_FTP,
|
2021-07-02 14:01:10 -04:00
|
|
|
PROTOCOL_GEMINI,
|
2005-09-15 09:58:31 -04:00
|
|
|
PROTOCOL_GOPHER,
|
|
|
|
PROTOCOL_HTTP,
|
|
|
|
PROTOCOL_HTTPS,
|
|
|
|
PROTOCOL_JAVASCRIPT,
|
2010-07-24 11:07:18 -04:00
|
|
|
PROTOCOL_MAILCAP,
|
2005-09-15 09:58:31 -04:00
|
|
|
PROTOCOL_NEWS,
|
|
|
|
PROTOCOL_NNTP,
|
|
|
|
PROTOCOL_NNTPS,
|
|
|
|
PROTOCOL_PROXY,
|
|
|
|
PROTOCOL_SMB,
|
|
|
|
PROTOCOL_SNEWS,
|
|
|
|
|
|
|
|
/* Keep these last! */
|
|
|
|
PROTOCOL_UNKNOWN,
|
|
|
|
PROTOCOL_USER,
|
|
|
|
PROTOCOL_LUA,
|
|
|
|
|
|
|
|
/* For protocol backend index checking */
|
|
|
|
PROTOCOL_BACKENDS,
|
|
|
|
};
|
|
|
|
|
2022-01-28 11:19:11 -05:00
|
|
|
typedef unsigned int protocol_T;
|
|
|
|
|
2005-09-15 09:58:31 -04:00
|
|
|
/* Besides the session an external handler also takes the url as an argument */
|
|
|
|
typedef void (protocol_handler_T)(struct connection *);
|
|
|
|
typedef void (protocol_external_handler_T)(struct session *, struct uri *);
|
|
|
|
|
|
|
|
/* Accessors for the protocol backends. */
|
|
|
|
|
2022-01-28 11:19:11 -05:00
|
|
|
int get_protocol_port(protocol_T protocol);
|
|
|
|
int get_protocol_need_slashes(protocol_T protocol);
|
|
|
|
int get_protocol_keep_double_slashes(protocol_T protocol);
|
|
|
|
int get_protocol_need_slash_after_host(protocol_T protocol);
|
|
|
|
int get_protocol_free_syntax(protocol_T protocol);
|
|
|
|
int get_protocol_need_ssl(protocol_T protocol);
|
2005-09-15 09:58:31 -04:00
|
|
|
|
2022-01-28 11:19:11 -05:00
|
|
|
protocol_handler_T *get_protocol_handler(protocol_T protocol);
|
2005-09-15 09:58:31 -04:00
|
|
|
protocol_external_handler_T *get_protocol_external_handler(struct terminal *, struct uri *);
|
|
|
|
|
|
|
|
/* Resolves the given protocol @name with length @namelen to a known protocol,
|
|
|
|
* PROTOCOL_UNKOWN or PROTOCOL_INVALID if no protocol part could be identified.
|
|
|
|
* User defined protocols (configurable via protocol.user) takes precedence. */
|
2022-02-21 11:13:14 -05:00
|
|
|
protocol_T get_protocol(const char *name, int namelen);
|
2005-09-15 09:58:31 -04:00
|
|
|
|
|
|
|
extern struct module protocol_module;
|
|
|
|
|
2020-10-05 14:14:55 -04:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2005-09-15 09:58:31 -04:00
|
|
|
#endif
|