version 1.1.1.1, 2013/07/22 08:44:29
|
version 1.1.1.3, 2021/03/17 00:39:23
|
Line 51
|
Line 51
|
* GLOBAL VARIABLES |
* GLOBAL VARIABLES |
*/ |
*/ |
|
|
const PhysType gPhysTypes[] = { | const struct phystype *gPhysTypes[] = { |
#define _WANT_DEVICE_TYPES |
#define _WANT_DEVICE_TYPES |
#include "devices.h" |
#include "devices.h" |
NULL, |
NULL, |
Line 246 PhysGetUpperHook(Link l, char *path, char *hook)
|
Line 246 PhysGetUpperHook(Link l, char *path, char *hook)
|
int |
int |
PhysGetOriginate(Link l) |
PhysGetOriginate(Link l) |
{ |
{ |
PhysType const pt = l->type; | const struct phystype *pt = l->type; |
|
|
return((pt && pt->originate) ? (*pt->originate)(l) : LINK_ORIGINATE_UNKNOWN); |
return((pt && pt->originate) ? (*pt->originate)(l) : LINK_ORIGINATE_UNKNOWN); |
} |
} |
Line 260 PhysGetOriginate(Link l)
|
Line 260 PhysGetOriginate(Link l)
|
int |
int |
PhysIsSync(Link l) |
PhysIsSync(Link l) |
{ |
{ |
PhysType const pt = l->type; | const struct phystype *pt = l->type; |
|
|
return((pt && pt->issync) ? (*pt->issync)(l) : 0); |
return((pt && pt->issync) ? (*pt->issync)(l) : 0); |
} |
} |
Line 272 PhysIsSync(Link l)
|
Line 272 PhysIsSync(Link l)
|
int |
int |
PhysSetCallingNum(Link l, char *buf) |
PhysSetCallingNum(Link l, char *buf) |
{ |
{ |
PhysType const pt = l->type; | const struct phystype *pt = l->type; |
|
|
if (pt && pt->setcallingnum) |
if (pt && pt->setcallingnum) |
return ((*pt->setcallingnum)(l, buf)); |
return ((*pt->setcallingnum)(l, buf)); |
Line 287 PhysSetCallingNum(Link l, char *buf)
|
Line 287 PhysSetCallingNum(Link l, char *buf)
|
int |
int |
PhysSetCalledNum(Link l, char *buf) |
PhysSetCalledNum(Link l, char *buf) |
{ |
{ |
PhysType const pt = l->type; | const struct phystype *pt = l->type; |
|
|
if (pt && pt->setcallednum) |
if (pt && pt->setcallednum) |
return ((*pt->setcallednum)(l, buf)); |
return ((*pt->setcallednum)(l, buf)); |
Line 302 PhysSetCalledNum(Link l, char *buf)
|
Line 302 PhysSetCalledNum(Link l, char *buf)
|
int |
int |
PhysGetSelfName(Link l, char *buf, size_t buf_len) |
PhysGetSelfName(Link l, char *buf, size_t buf_len) |
{ |
{ |
PhysType const pt = l->type; | const struct phystype *pt = l->type; |
|
|
buf[0] = 0; |
buf[0] = 0; |
|
|
Line 319 PhysGetSelfName(Link l, char *buf, size_t buf_len)
|
Line 319 PhysGetSelfName(Link l, char *buf, size_t buf_len)
|
int |
int |
PhysGetPeerName(Link l, char *buf, size_t buf_len) |
PhysGetPeerName(Link l, char *buf, size_t buf_len) |
{ |
{ |
PhysType const pt = l->type; | const struct phystype *pt = l->type; |
|
|
buf[0] = 0; |
buf[0] = 0; |
|
|
Line 336 PhysGetPeerName(Link l, char *buf, size_t buf_len)
|
Line 336 PhysGetPeerName(Link l, char *buf, size_t buf_len)
|
int |
int |
PhysGetSelfAddr(Link l, char *buf, size_t buf_len) |
PhysGetSelfAddr(Link l, char *buf, size_t buf_len) |
{ |
{ |
PhysType const pt = l->type; | const struct phystype *pt = l->type; |
|
|
buf[0] = 0; |
buf[0] = 0; |
|
|
Line 353 PhysGetSelfAddr(Link l, char *buf, size_t buf_len)
|
Line 353 PhysGetSelfAddr(Link l, char *buf, size_t buf_len)
|
int |
int |
PhysGetPeerAddr(Link l, char *buf, size_t buf_len) |
PhysGetPeerAddr(Link l, char *buf, size_t buf_len) |
{ |
{ |
PhysType const pt = l->type; | const struct phystype *pt = l->type; |
|
|
buf[0] = 0; |
buf[0] = 0; |
|
|
Line 370 PhysGetPeerAddr(Link l, char *buf, size_t buf_len)
|
Line 370 PhysGetPeerAddr(Link l, char *buf, size_t buf_len)
|
int |
int |
PhysGetPeerPort(Link l, char *buf, size_t buf_len) |
PhysGetPeerPort(Link l, char *buf, size_t buf_len) |
{ |
{ |
PhysType const pt = l->type; | const struct phystype *pt = l->type; |
|
|
buf[0] = 0; |
buf[0] = 0; |
|
|
Line 387 PhysGetPeerPort(Link l, char *buf, size_t buf_len)
|
Line 387 PhysGetPeerPort(Link l, char *buf, size_t buf_len)
|
int |
int |
PhysGetPeerMacAddr(Link l, char *buf, size_t buf_len) |
PhysGetPeerMacAddr(Link l, char *buf, size_t buf_len) |
{ |
{ |
PhysType const pt = l->type; | const struct phystype *pt = l->type; |
|
|
buf[0] = 0; |
buf[0] = 0; |
|
|
Line 404 PhysGetPeerMacAddr(Link l, char *buf, size_t buf_len)
|
Line 404 PhysGetPeerMacAddr(Link l, char *buf, size_t buf_len)
|
int |
int |
PhysGetPeerIface(Link l, char *buf, size_t buf_len) |
PhysGetPeerIface(Link l, char *buf, size_t buf_len) |
{ |
{ |
PhysType const pt = l->type; | const struct phystype *pt = l->type; |
|
|
buf[0] = 0; |
buf[0] = 0; |
|
|
Line 421 PhysGetPeerIface(Link l, char *buf, size_t buf_len)
|
Line 421 PhysGetPeerIface(Link l, char *buf, size_t buf_len)
|
int |
int |
PhysGetCallingNum(Link l, char *buf, size_t buf_len) |
PhysGetCallingNum(Link l, char *buf, size_t buf_len) |
{ |
{ |
PhysType const pt = l->type; | const struct phystype *pt = l->type; |
|
|
buf[0] = 0; |
buf[0] = 0; |
|
|
Line 455 PhysGetCallingNum(Link l, char *buf, size_t buf_len)
|
Line 455 PhysGetCallingNum(Link l, char *buf, size_t buf_len)
|
int |
int |
PhysGetCalledNum(Link l, char *buf, size_t buf_len) |
PhysGetCalledNum(Link l, char *buf, size_t buf_len) |
{ |
{ |
PhysType const pt = l->type; | const struct phystype *pt = l->type; |
|
|
buf[0] = 0; |
buf[0] = 0; |
|
|
Line 466 PhysGetCalledNum(Link l, char *buf, size_t buf_len)
|
Line 466 PhysGetCalledNum(Link l, char *buf, size_t buf_len)
|
} |
} |
|
|
/* |
/* |
|
* PhysGetMtu() |
|
*/ |
|
|
|
u_short |
|
PhysGetMtu(Link l, int conf) |
|
{ |
|
const struct phystype *pt = l->type; |
|
|
|
if (pt) { |
|
if (pt->getmtu) |
|
return ((*pt->getmtu)(l, conf)); |
|
if (conf == 0) { |
|
if (pt->mtu) |
|
return (pt->mtu); |
|
else |
|
return (0); |
|
} else |
|
return (l->conf.mtu); |
|
} else |
|
return (0); |
|
} |
|
|
|
/* |
|
* PhysGetMru() |
|
*/ |
|
|
|
u_short |
|
PhysGetMru(Link l, int conf) |
|
{ |
|
const struct phystype *pt = l->type; |
|
|
|
if (pt) { |
|
if (pt->getmru) |
|
return ((*pt->getmru)(l, conf)); |
|
if (conf == 0) { |
|
if (pt->mru) |
|
return (pt->mru); |
|
else |
|
return (0); |
|
} else |
|
return (l->conf.mru); |
|
} else |
|
return (0); |
|
} |
|
|
|
/* |
* PhysIsBusy() |
* PhysIsBusy() |
* |
* |
* This returns 1 if link is busy |
* This returns 1 if link is busy |
Line 486 PhysIsBusy(Link l)
|
Line 532 PhysIsBusy(Link l)
|
void |
void |
PhysShutdown(Link l) |
PhysShutdown(Link l) |
{ |
{ |
PhysType const pt = l->type; | const struct phystype *pt = l->type; |
|
|
MsgUnRegister(&l->pmsgs); |
MsgUnRegister(&l->pmsgs); |
|
|
Line 501 PhysShutdown(Link l)
|
Line 547 PhysShutdown(Link l)
|
void |
void |
PhysSetDeviceType(Link l, char *typename) |
PhysSetDeviceType(Link l, char *typename) |
{ |
{ |
PhysType pt; | const struct phystype *pt; |
int k; |
int k; |
|
|
/* Make sure device type not already set */ |
/* Make sure device type not already set */ |
Line 569 PhysMsg(int type, void *arg)
|
Line 615 PhysMsg(int type, void *arg)
|
*/ |
*/ |
|
|
int |
int |
PhysStat(Context ctx, int ac, char *av[], void *arg) | PhysStat(Context ctx, int ac, const char *const av[], const void *arg) |
{ |
{ |
Link const l = ctx->lnk; |
Link const l = ctx->lnk; |
|
|
|
(void)ac; |
|
(void)av; |
|
(void)arg; |
|
|
Printf("Device '%s' (%s)\r\n", l->name, (l->tmpl)?"template":"instance"); |
Printf("Device '%s' (%s)\r\n", l->name, (l->tmpl)?"template":"instance"); |
Printf("\tType : %s\r\n", l->type->name); |
Printf("\tType : %s\r\n", l->type->name); |