Commit aace645d authored by rswindell's avatar rswindell
Browse files

Packet Type-2e (FSC-39.4) support:

For packet creation, the only difference (from Type-2+) is with packets created
from point nodes: the origNet field won't be set to 0xffff (as is the case with
FSC-48, Type-2+ packets). The auxNet field is now always set to the originating
net (ala Squish) when configured for Type-2+ packet generation.
When importing Type-2e (FSC-39) packets, the detected/logged packet type may be
reported as "2e" for valid "2+" packets. This is normal and expected when the
originating node is not a point and the auxNet field is 0.
The second set of orig/dest zone fields in a type 2e/2+ pkt header will
now be used when importing if the old/QM orig/dest zone fields are 0.
Also, the originating point field may now be imported even if the auxNet field
is not used (origNet != 0xffff).

New umask sbbsecho.ini configuration option (global), maybe used to over-ride
the default *nix file creation mode mask (077), similar to sbbs.ini.
parent dbaa70bc
......@@ -399,8 +399,8 @@ int main(int argc, char **argv)
"\r\n"
"`Packet Type` is the type of outbound packet generated for this node.\r\n"
"Incoming packet types are automatically detected from among the list\r\n"
"of supported packet types (2, 2.2, and 2+).\r\n"
"The default outbound packet type is type `2+`.\r\n"
"of supported packet types (`2`, `2.2`, `2e`, and `2+`).\r\n"
"The default outbound packet type is `Type-2+`.\r\n"
"\r\n"
"`Packet Password` is an optional password that may be added to outbound\r\n"
"packets for this node. Incoming packets from this node must also have\r\n"
......@@ -525,7 +525,13 @@ int main(int argc, char **argv)
uifc.helpbuf=
"~ Packet Type ~\r\n\r\n"
"This is the packet header type that will be used in mail packets\r\n"
"created for this node. SBBSecho defaults to using packet type `2+`.\r\n";
"created for this node. SBBSecho defaults to creating `Type-2+` packets.\r\n"
"\r\n"
"`Type-2 ` packets are defined in FTS-0001.16 (Stone Age)\r\n"
"`Type-2e ` packets are defined in FSC-0039.04 (Sometimes called 2+)\r\n"
"`Type-2+ ` packets are defined in FSC-0048.02 (4D address support)\r\n"
"`Type-2.2` packets are defined in FSC-0045.01 (5D address support)\r\n"
;
j=cfg.nodecfg[i].pkt_type;
k=uifc.list(WIN_RHT|WIN_SAV,0,0,0,&j,0,"Packet Type"
,pktTypeStringList);
......
......@@ -221,9 +221,10 @@ void get_default_echocfg(sbbsecho_cfg_t* cfg)
cfg->use_ftn_domains = false;
cfg->strict_packet_passwords = true;
cfg->relay_filtered_msgs = false;
cfg->umask = 077;
}
char* pktTypeStringList[] = {"2+", "2.2", "2", NULL};
char* pktTypeStringList[] = {"2+", "2e", "2.2", "2", NULL}; // Must match enum pkt_type
char* mailStatusStringList[] = {"Normal", "Hold", "Crash", NULL};
bool sbbsecho_read_ini(sbbsecho_cfg_t* cfg)
......@@ -260,6 +261,7 @@ bool sbbsecho_read_ini(sbbsecho_cfg_t* cfg)
cfg->use_ftn_domains = iniGetBool(ini, ROOT_SECTION, "UseFTNDomains", cfg->use_ftn_domains);
cfg->strict_packet_passwords= iniGetBool(ini, ROOT_SECTION, "StrictPacketPasswords", cfg->strict_packet_passwords);
cfg->relay_filtered_msgs = iniGetBool(ini, ROOT_SECTION, "RelayFilteredMsgs", cfg->relay_filtered_msgs);
cfg->umask = iniGetInteger(ini, ROOT_SECTION, "umask", cfg->umask);
/* EchoMail options: */
cfg->maxbdlsize = (ulong)iniGetBytes(ini, ROOT_SECTION, "BundleSize", 1, cfg->maxbdlsize);
......
......@@ -592,7 +592,7 @@ bool parse_pkthdr(const fpkthdr_t* hdr, fidoaddr_t* orig_addr, fidoaddr_t* dest_
{
fidoaddr_t orig;
fidoaddr_t dest;
enum pkt_type type = PKT_TYPE_2_0;
enum pkt_type type = PKT_TYPE_2;
if(hdr->type2.pkttype != 2)
return false;
......@@ -607,13 +607,17 @@ bool parse_pkthdr(const fpkthdr_t* hdr, fidoaddr_t* orig_addr, fidoaddr_t* dest_
dest.node = hdr->type2.destnode;
dest.point = 0; /* No point info in the 2.0 hdr! */
if(hdr->type2plus.cword == BYTE_SWAP_16(hdr->type2plus.cwcopy) /* 2+ Packet Header (FSC-39) */
&& (hdr->type2plus.cword&1)) {
type = PKT_TYPE_2_PLUS;
if(hdr->type2plus.cword == BYTE_SWAP_16(hdr->type2plus.cwcopy) /* 2e Packet Header (FSC-39) */
&& (hdr->type2plus.cword&1)) { /* Some call this a Type-2+ packet, but it's not (yet) FSC-48 conforming */
type = PKT_TYPE_2_EXT;
orig.point = hdr->type2plus.origpoint;
dest.point = hdr->type2plus.destpoint;
if(hdr->type2plus.origpoint!=0 && orig.net == 0xffff) { /* see FSC-0048 for details */
orig.net = hdr->type2plus.auxnet;
orig.point = hdr->type2plus.origpoint;
if(orig.zone == 0) orig.zone = hdr->type2plus.origzone;
if(dest.zone == 0) dest.zone = hdr->type2plus.destzone;
if(hdr->type2plus.auxnet != 0) { /* strictly speaking, auxnet may be 0 and a valid 2+ packet */
type = PKT_TYPE_2_PLUS;
if(orig.point != 0 && orig.net == 0xffff) /* see FSC-0048 for details */
orig.net = hdr->type2plus.auxnet;
}
} else if(hdr->type2_2.subversion==2) { /* Type 2.2 Packet Header (FSC-45) */
type = PKT_TYPE_2_2;
......@@ -633,7 +637,7 @@ bool parse_pkthdr(const fpkthdr_t* hdr, fidoaddr_t* orig_addr, fidoaddr_t* dest_
bool new_pkthdr(fpkthdr_t* hdr, fidoaddr_t orig, fidoaddr_t dest, const nodecfg_t* nodecfg)
{
enum pkt_type pkt_type = PKT_TYPE_2_0;
enum pkt_type pkt_type = PKT_TYPE_2;
struct tm* tm;
time_t now = time(NULL);
......@@ -665,7 +669,7 @@ bool new_pkthdr(fpkthdr_t* hdr, fidoaddr_t orig, fidoaddr_t dest, const nodecfg_
if(nodecfg != NULL && nodecfg->pktpwd[0] != 0)
strncpy((char*)hdr->type2.password, nodecfg->pktpwd, sizeof(hdr->type2.password));
if(pkt_type == PKT_TYPE_2_0)
if(pkt_type == PKT_TYPE_2)
return true;
if(pkt_type == PKT_TYPE_2_2) {
......@@ -675,15 +679,16 @@ bool new_pkthdr(fpkthdr_t* hdr, fidoaddr_t orig, fidoaddr_t dest, const nodecfg_
return true;
}
/* 2+ */
if(pkt_type != PKT_TYPE_2_PLUS) {
/* 2e and 2+ */
if(pkt_type != PKT_TYPE_2_EXT && pkt_type != PKT_TYPE_2_PLUS) {
lprintf(LOG_ERR, "UNSUPPORTED PACKET TYPE: %u", pkt_type);
return false;
}
if(orig.point != 0) {
hdr->type2plus.orignet = 0xffff;
hdr->type2plus.auxnet = orig.net;
if(pkt_type == PKT_TYPE_2_PLUS) {
if(orig.point != 0)
hdr->type2plus.orignet = 0xffff;
hdr->type2plus.auxnet = orig.net; /* Squish always copies the orignet here */
}
hdr->type2plus.cword = 0x0001;
hdr->type2plus.cwcopy = 0x0100;
......@@ -5149,6 +5154,10 @@ int main(int argc, char **argv)
bail(1);
}
#if defined(__unix__)
umask(cfg.umask);
#endif
if((fidologfile=fopen(cfg.logfile,"a"))==NULL) {
fprintf(stderr,"ERROR %u (%s) line %d opening %s\n",errno,strerror(errno),__LINE__,cfg.logfile);
bail(1);
......
......@@ -55,9 +55,10 @@ enum mail_status {
};
enum pkt_type {
PKT_TYPE_2_PLUS /* Type 2+ Packet Header (FSC-48) */
,PKT_TYPE_2_2 /* Type 2.2 Packet Header (FSC-45) */
,PKT_TYPE_2_0 /* Old Type Packet Header (FTS-1) */
PKT_TYPE_2_PLUS /* Type-2+ Packet Header (FSC-48) */
,PKT_TYPE_2_EXT /* Type-2e Packet Header (FSC-39) */
,PKT_TYPE_2_2 /* Type-2.2 Packet Header (FSC-45) */
,PKT_TYPE_2 /* Type-2 Packet Header (FTS-1) */
};
#define DFLT_PKT_SIZE (250*1024L)
......@@ -147,6 +148,7 @@ typedef struct {
,listcfgs /* Number of echolists defined */
,areas /* Number of areas defined */
;
uint umask;
char default_recipient[LEN_ALIAS+1];
char areamgr[LEN_ALIAS+1]; /* User to notify of areafix activity */
arcdef_t* arcdef; /* Each archive definition */
......@@ -181,7 +183,7 @@ typedef struct {
struct zone_mapping *zone_map; //
} sbbsecho_cfg_t;
char* pktTypeStringList[4];
char* pktTypeStringList[];
char* mailStatusStringList[4];
/***********************/
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment