* \brief PacketCable COPS
*
* \author Attila Domjan <attila.domjan.hu@gmail.com>
+ *
+ * \note
+ * This module is an add-on to chan_mgcp. It adds support for the
+ * PacketCable MGCP variation called NCS. Res_pktccops implements COPS
+ * (RFC 2748), a protocol used to manage dynamic bandwith allocation in
+ * CMTS's (HFC gateways). When you use NCS, you need to talk COPS with
+ * the CMTS to complete the calls.
*/
+/*** MODULEINFO
+ <defaultenabled>no</defaultenabled>
+ ***/
+
#include "asterisk.h"
ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
}
errno = 0;
- if (send(sfd, buf, sendmsg->length, MSG_NOSIGNAL | MSG_DONTWAIT ) == -1) {
+#ifdef HAVE_MSG_NOSIGNAL
+#define SENDFLAGS MSG_NOSIGNAL | MSG_DONTWAIT
+#else
+#define SENDFLAGS MSG_DONTWAIT
+#endif
+ if (send(sfd, buf, sendmsg->length, SENDFLAGS) == -1) {
ast_log(LOG_WARNING, "COPS: Send failed errno=%i\n", errno);
free(buf);
return -2;
}
+#undef SENDFLAGS
free(buf);
return 0;
}
struct addrinfo hints;
struct addrinfo *rp;
struct addrinfo *result;
+#ifdef HAVE_SO_NOSIGPIPE
+ int trueval = 1;
+#endif
memset(&hints, 0, sizeof(struct addrinfo));
}
flags = fcntl(sfd, F_GETFL);
fcntl(sfd, F_SETFL, flags | O_NONBLOCK);
+#ifdef HAVE_SO_NOSIGPIPE
+ setsockopt(sfd, SO_SOCKET, SO_NOSIGPIPE, &trueval, sizeof(trueval));
+#endif
connect(sfd, rp->ai_addr, rp->ai_addrlen);
if (sfd == -1) {
ast_log(LOG_WARNING, "Failed connect\n");
e->command = "pktccops set debug {on|off}";
e->usage =
"Usage: pktccops set debug {on|off}\n"
- " Turn on/off debuging\n";
+ " Turn on/off debuging\n";
return NULL;
case CLI_GENERATE:
return NULL;
static int unload_module(void)
{
if (!ast_mutex_lock(&pktccops_lock)) {
- if (pktccops_thread && (pktccops_thread != AST_PTHREADT_STOP)) {
+ if ((pktccops_thread != AST_PTHREADT_NULL) && (pktccops_thread != AST_PTHREADT_STOP)) {
pthread_cancel(pktccops_thread);
pthread_kill(pktccops_thread, SIGURG);
pthread_join(pktccops_thread, NULL);
pktccops_thread = AST_PTHREADT_STOP;
ast_mutex_unlock(&pktccops_lock);
} else {
- ast_log(LOG_WARNING, "Unable to lock the pktccops_thread\n");
+ ast_log(LOG_ERROR, "Unable to lock the pktccops_thread\n");
return -1;
}
return 0;
}
-AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS, "PktcCOPS manager",
+AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS, "PktcCOPS manager for MGCP",
.load = load_module,
.unload = unload_module,
.reload = reload_module,