2
2
* libpri: An implementation of Primary Rate ISDN
4
* Written by Mark Spencer <markster@linux-support.net>
4
* Written by Mark Spencer <markster@digium.com>
6
* Copyright (C) 2001, Linux Support Services, Inc.
6
* Copyright (C) 2001-2005, Digium
7
7
* All Rights Reserved.
9
9
* This program is free software; you can redistribute it and/or modify
70
static void dump_packet(char *buf, int len, int txrx)
70
static void dump_packet(struct pri *pri, char *buf, int len, int txrx)
72
72
q921_h *h = (q921_h *)buf;
73
q921_dump(h, len, 1, txrx);
73
q921_dump(pri, h, len, 1, txrx);
74
74
if (!((h->h.data[0] & Q921_FRAMETYPE_MASK) & 0x3)) {
75
q931_dump((q931_h *)(h->i.data), len - 4, txrx);
75
q931_dump(pri, (q931_h *)(h->i.data), len - 4 - 2 /* FCS */, txrx);
103
103
if (FD_ISSET(d1, &fds)) {
104
104
/* Copy from d1 to d2 */
105
105
res = read(d1, buf, sizeof(buf));
106
dump_packet(buf, res, 1);
106
dump_packet((struct pri *)NULL, buf, res, 1);
107
107
res = write(d2, buf, res);
109
109
if (FD_ISSET(d2, &fds)) {
110
110
/* Copy from d2 to d1 */
111
111
res = read(d2, buf, sizeof(buf));
112
dump_packet(buf, res, 0);
112
dump_packet((struct pri *)NULL, buf, res, 0);
113
113
res = write(d1, buf, res);
118
static void my_pri_message(struct pri *pri, char *stuff)
120
fprintf(stdout, "%s", stuff);
123
static void my_pri_error(struct pri *pri, char *stuff)
125
fprintf(stderr, "%s", stuff);
118
128
int main(int argc, char *argv[])