projects
/
lcr.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
changed long to int (64 bit system's compatibilty)
[lcr.git]
/
endpoint.cpp
diff --git
a/endpoint.cpp
b/endpoint.cpp
index
3f67f41
..
1dce9f1
100644
(file)
--- a/
endpoint.cpp
+++ b/
endpoint.cpp
@@
-1,18
+1,17
@@
/*****************************************************************************\
** **
/*****************************************************************************\
** **
-**
PBX4Linux
**
+**
Linux Call Router
**
** **
**---------------------------------------------------------------------------**
** Copyright: Andreas Eversberg **
** **
** **
**---------------------------------------------------------------------------**
** Copyright: Andreas Eversberg **
** **
-** The Endpoint is the link between the
call
and the port. **
+** The Endpoint is the link between the
join
and the port. **
** **
\*****************************************************************************/
** **
\*****************************************************************************/
-#include <stdio.h>
#include "main.h"
#include "main.h"
-unsigned
long
epoint_serial = 1; /* initial value must be 1, because 0== no epoint */
+unsigned
int
epoint_serial = 1; /* initial value must be 1, because 0== no epoint */
class Endpoint *epoint_first = NULL;
class Endpoint *epoint_first = NULL;
@@
-20,7
+19,7
@@
class Endpoint *epoint_first = NULL;
/*
* find the epoint with epoint_id
*/
/*
* find the epoint with epoint_id
*/
-class Endpoint *find_epoint_id(unsigned
long
epoint_id)
+class Endpoint *find_epoint_id(unsigned
int
epoint_id)
{
class Endpoint *epoint = epoint_first;
{
class Endpoint *epoint = epoint_first;
@@
-37,15
+36,16
@@
class Endpoint *find_epoint_id(unsigned long epoint_id)
/*
/*
- * endpoint constructor (link with either port or
call
id)
+ * endpoint constructor (link with either port or
join
id)
*/
*/
-Endpoint::Endpoint(
int port_id, int call
_id)
+Endpoint::Endpoint(
unsigned int port_id, unsigned int join
_id)
{
class Port *port;
class Endpoint **epointpointer;
{
class Port *port;
class Endpoint **epointpointer;
+ int earlyb = 0;
/* epoint structure */
/* epoint structure */
- PDEBUG(DEBUG_EPOINT, "EPOINT(%d): Allocating enpoint %d and connecting it with:%s%s\n", epoint_serial, epoint_serial, (port_id)?" ioport":"", (
call_id)?" call
":"");
+ PDEBUG(DEBUG_EPOINT, "EPOINT(%d): Allocating enpoint %d and connecting it with:%s%s\n", epoint_serial, epoint_serial, (port_id)?" ioport":"", (
join_id)?" join
":"");
ep_portlist = NULL;
ep_app = NULL;
ep_portlist = NULL;
ep_app = NULL;
@@
-61,18
+61,19
@@
Endpoint::Endpoint(int port_id, int call_id)
/* serial */
ep_serial = epoint_serial++;
/* serial */
ep_serial = epoint_serial++;
- /* link to
call
or port */
+ /* link to
join
or port */
if (port_id)
{
port = find_port_id(port_id);
if (port)
if (port_id)
{
port = find_port_id(port_id);
if (port)
- if (!portlist_new(port_id, port->p_type))
{
{
- PERROR("no mem for portlist, exitting...\n");
- exit(-1);
+ if ((port->p_type&PORT_CLASS_mISDN_MASK) == PORT_CLASS_mISDN_DSS1)
+ earlyb = ((class PmISDN *)port)->p_m_mISDNport->earlyb;
+ if (!portlist_new(port_id, port->p_type, earlyb))
+ FATAL("No memory for portlist.\n");
}
}
}
}
- ep_
call_id = call
_id;
+ ep_
join_id = join
_id;
ep_park = 0;
ep_park_len = 0;
ep_park = 0;
ep_park_len = 0;
@@
-96,9
+97,9
@@
Endpoint::~Endpoint(void)
delete ep_app;
/* free relations */
delete ep_app;
/* free relations */
- if (ep_
call
_id)
+ if (ep_
join
_id)
{
{
- PERROR("warning: still relation to
call
.\n");
+ PERROR("warning: still relation to
join
.\n");
}
/* free portlist */
}
/* free portlist */
@@
-112,7
+113,7
@@
Endpoint::~Endpoint(void)
mtemp = portlist;
portlist = portlist->next;
memset(mtemp, 0, sizeof(struct port_list));
mtemp = portlist;
portlist = portlist->next;
memset(mtemp, 0, sizeof(struct port_list));
-
free(mtemp
);
+
FREE(mtemp, sizeof(struct port_list)
);
ememuse--;
}
ememuse--;
}
@@
-128,10
+129,7
@@
Endpoint::~Endpoint(void)
temp = temp->next;
}
if (temp == 0)
temp = temp->next;
}
if (temp == 0)
- {
- PERROR("error: endpoint not in endpoint's list, exitting.\n");
- exit(-1);
- }
+ FATAL("Endpoint not in Endpoint's list.\n");
*tempp = next;
/* free */
*tempp = next;
/* free */
@@
-140,20
+138,14
@@
Endpoint::~Endpoint(void)
/* create new portlist relation
*/
/* create new portlist relation
*/
-struct port_list *Endpoint::portlist_new(unsigned
long port_id, int port_type
)
+struct port_list *Endpoint::portlist_new(unsigned
int port_id, int port_type, int earlyb
)
{
struct port_list *portlist, **portlistpointer;
/* portlist structure */
{
struct port_list *portlist, **portlistpointer;
/* portlist structure */
- portlist = (struct port_list *)calloc(1, sizeof(struct port_list));
- if (!portlist)
- {
- PERROR("no mem for allocating port_list\n");
- return(0);
- }
+ portlist = (struct port_list *)MALLOC(sizeof(struct port_list));
ememuse++;
PDEBUG(DEBUG_EPOINT, "EPOINT(%d) allocating port_list.\n", ep_serial);
ememuse++;
PDEBUG(DEBUG_EPOINT, "EPOINT(%d) allocating port_list.\n", ep_serial);
- memset(portlist, 0, sizeof(struct port_list));
/* add port_list to chain */
portlist->next = NULL;
/* add port_list to chain */
portlist->next = NULL;
@@
-162,9
+154,10
@@
struct port_list *Endpoint::portlist_new(unsigned long port_id, int port_type)
portlistpointer = &((*portlistpointer)->next);
*portlistpointer = portlist;
portlistpointer = &((*portlistpointer)->next);
*portlistpointer = portlist;
- /* link to
call
or port */
+ /* link to
join
or port */
portlist->port_id = port_id;
portlist->port_type = port_type;
portlist->port_id = port_id;
portlist->port_type = port_type;
+ portlist->early_b = earlyb;
return(portlist);
}
return(portlist);
}
@@
-186,18
+179,14
@@
void Endpoint::free_portlist(struct port_list *portlist)
tempp = &temp->next;
temp = temp->next;
}
tempp = &temp->next;
temp = temp->next;
}
- if (temp == 0)
- {
- PERROR("port_list not in endpoint's list, exitting.\n");
- exit(-1);
- }
+ if (!temp)
+ FATAL("port_list not in Endpoint's list.\n");
/* detach */
*tempp=portlist->next;
/* free */
PDEBUG(DEBUG_EPOINT, "EPOINT(%d) removed port_list from endpoint\n", ep_serial);
/* detach */
*tempp=portlist->next;
/* free */
PDEBUG(DEBUG_EPOINT, "EPOINT(%d) removed port_list from endpoint\n", ep_serial);
- memset(portlist, 0, sizeof(struct port_list));
- free(portlist);
+ FREE(portlist, sizeof(struct port_list));
ememuse--;
}
ememuse--;
}