diff options
author | tzafrir <tzafrir@5390a7c7-147a-4af0-8ec9-7488f05a26cb> | 2007-01-25 06:45:00 +0000 |
---|---|---|
committer | tzafrir <tzafrir@5390a7c7-147a-4af0-8ec9-7488f05a26cb> | 2007-01-25 06:45:00 +0000 |
commit | 7394c732e665a294875576cf85135e69980d6713 (patch) | |
tree | 341aee781e56a52b7a3f8bc133a9f0ac6d9e93a6 | |
parent | d41cc2f97efdd332b3f0092e9ef85143652d50c8 (diff) |
xproto old code cleanup:
- Remove old SOFT_SIMULATOR (not used in the last year ;-)
- As a result can merge packet_receive() and packet_process()
- Remove unused macro (MAX_XPACKET_DATALEN) from xproto.h
git-svn-id: http://svn.digium.com/svn/zaptel/branches/1.2@1962 5390a7c7-147a-4af0-8ec9-7488f05a26cb
-rw-r--r-- | xpp/xproto.c | 39 | ||||
-rw-r--r-- | xpp/xproto.h | 3 |
2 files changed, 12 insertions, 30 deletions
diff --git a/xpp/xproto.c b/xpp/xproto.c index ebd9bba..4c72d3f 100644 --- a/xpp/xproto.c +++ b/xpp/xproto.c @@ -31,7 +31,6 @@ static const char rcsid[] = "$Id$"; extern int print_dbg; -static int packet_process(xbus_t *xbus, int xpd_num, xpacket_t *pack); static const xproto_table_t *xprotocol_tables[XPD_TYPE_NOMODULE]; @@ -156,39 +155,23 @@ static const xproto_entry_t *find_xproto_entry(xpd_t *xpd, byte opcode) int packet_receive(xbus_t *xbus, xpacket_t *pack) { - int xpd_num; - - if(!valid_xpd_addr(&pack->content.addr)) { - static int rate_limit = 0; - - if((rate_limit++ % 5003) < 3) - dump_packet("bad address", pack, print_dbg); - xbus->ops->packet_free(xbus, pack); - return -EPROTO; - } - xpd_num = XPD_NUM(pack->content.addr); -#ifdef SOFT_SIMULATOR - if(xbus->sim[xpd_num].simulated) { - //dump_packet("packet_receive -> simulate", pack, print_dbg); - return simulate_xpd(xbus, xpd_num, pack); - } else -#endif - { - //dump_packet("packet_receive -> process", pack, print_dbg); - return packet_process(xbus, xpd_num, pack); - } -} - -static int packet_process(xbus_t *xbus, int xpd_num, xpacket_t *pack) -{ byte op; const xproto_entry_t *xe; xproto_handler_t handler; xproto_table_t *table; xpd_t *xpd; + int xpd_num; int ret = 0; BUG_ON(!pack); + if(!valid_xpd_addr(&pack->content.addr)) { + static int rate_limit = 0; + + if((rate_limit++ % 5003) < 3) + dump_packet("packet_receive -- bad address", pack, print_dbg); + ret = -EPROTO; + goto out; + } op = pack->content.opcode; xpd_num = XPD_NUM(pack->content.addr); xpd = xpd_of(xbus, xpd_num); @@ -197,7 +180,7 @@ static int packet_process(xbus_t *xbus, int xpd_num, xpacket_t *pack) if(!xe) { ERR("xpp: %s: %s unit #%d: bad command op=0x%02X\n", __FUNCTION__, xbus->busname, xpd_num, op); - dump_packet("packet_process -- bad command", pack, print_dbg); + dump_packet("packet_receive -- bad command", pack, print_dbg); ret = -EPROTO; goto out; } @@ -206,7 +189,7 @@ static int packet_process(xbus_t *xbus, int xpd_num, xpacket_t *pack) if(!table->packet_is_valid(pack)) { ERR("xpp: %s: wrong size %d for op=0x%02X\n", __FUNCTION__, pack->datalen, op); - dump_packet("packet_process -- wrong size", pack, print_dbg); + dump_packet("packet_receive -- wrong size", pack, print_dbg); ret = -EPROTO; goto out; } diff --git a/xpp/xproto.h b/xpp/xproto.h index 377c06e..383ce4b 100644 --- a/xpp/xproto.h +++ b/xpp/xproto.h @@ -63,7 +63,6 @@ int xpd_addr2num(const xpd_addr_t *addr); void xpd_set_addr(xpd_addr_t *addr, int xpd_num); #define XPD_NUM(x) xpd_addr2num(&x) -#define MAX_XPACKET_DATALEN 100 #define XPROTO_NAME(card,op) card ## _ ## op #define XPROTO_HANDLER(card,op) XPROTO_NAME(card,op ## _handler) @@ -90,7 +89,7 @@ void xpd_set_addr(xpd_addr_t *addr, int xpd_num); #define RPACKET_TYPE(card,op) struct RPACKET_NAME(card, op) #define DEF_RPACKET_DATA(card,op, ...) \ - struct RPACKET_NAME(card,op) { \ + RPACKET_TYPE(card,op) { \ byte opcode; \ xpd_addr_t addr; \ __VA_ARGS__ \ |