[zaptel-commits] tzafrir: branch 1.2 r1962 - in /branches/1.2/xpp:
xproto.c xproto.h
zaptel-commits at lists.digium.com
zaptel-commits at lists.digium.com
Wed Jan 24 23:45:00 MST 2007
Author: tzafrir
Date: Thu Jan 25 00:45:00 2007
New Revision: 1962
URL: http://svn.digium.com/view/zaptel?view=rev&rev=1962
Log:
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
Modified:
branches/1.2/xpp/xproto.c
branches/1.2/xpp/xproto.h
Modified: branches/1.2/xpp/xproto.c
URL: http://svn.digium.com/view/zaptel/branches/1.2/xpp/xproto.c?view=diff&rev=1962&r1=1961&r2=1962
==============================================================================
--- branches/1.2/xpp/xproto.c (original)
+++ branches/1.2/xpp/xproto.c Thu Jan 25 00:45:00 2007
@@ -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 @@
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 @@
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 @@
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;
}
Modified: branches/1.2/xpp/xproto.h
URL: http://svn.digium.com/view/zaptel/branches/1.2/xpp/xproto.h?view=diff&rev=1962&r1=1961&r2=1962
==============================================================================
--- branches/1.2/xpp/xproto.h (original)
+++ branches/1.2/xpp/xproto.h Thu Jan 25 00:45:00 2007
@@ -63,7 +63,6 @@
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 @@
#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__ \
More information about the zaptel-commits
mailing list