40 #include <sys/types.h> 41 #include <sys/socket.h> 50 #include <arpa/inet.h> 62 #define AST_API_MODULE 65 #define DEFAULT_COPS_PORT "2126" 67 #define COPS_HEADER_SIZE 8 68 #define COPS_OBJECT_HEADER_SIZE 4 69 #define GATE_SET_OBJ_SIZE 144 70 #define GATEID_OBJ_SIZE 8 71 #define GATE_INFO_OBJ_SIZE 24 73 #define PKTCCOPS_SCOMMAND_GATE_ALLOC 1 74 #define PKTCCOPS_SCOMMAND_GATE_ALLOC_ACK 2 75 #define PKTCCOPS_SCOMMAND_GATE_ALLOC_ERR 3 76 #define PKTCCOPS_SCOMMAND_GATE_SET 4 77 #define PKTCCOPS_SCOMMAND_GATE_SET_ACK 5 78 #define PKTCCOPS_SCOMMAND_GATE_SET_ERR 6 79 #define PKTCCOPS_SCOMMAND_GATE_INFO 7 80 #define PKTCCOPS_SCOMMAND_GATE_INFO_ACK 8 81 #define PKTCCOPS_SCOMMAND_GATE_INFO_ERR 9 82 #define PKTCCOPS_SCOMMAND_GATE_DELETE 10 83 #define PKTCCOPS_SCOMMAND_GATE_DELETE_ACK 11 84 #define PKTCCOPS_SCOMMAND_GATE_DELETE_ERR 12 85 #define PKTCCOPS_SCOMMAND_GATE_OPEN 13 86 #define PKTCCOPS_SCOMMAND_GATE_CLOSE 14 157 static uint16_t
t1 = 250;
158 static uint16_t
t7 = 200;
159 static uint16_t
t8 = 300;
190 *(res + 2) = (char) gs->
flags;
193 *((uint32_t *) (res + 4)) = gs->
srcip;
194 *((uint32_t *) (res + 8)) = gs->
dstip;
196 *((uint16_t *) (res + 12)) = gs->
srcp;
197 *((uint16_t *) (res + 14)) = gs->
dstp;
204 *((uint16_t *) (res + 20)) = gs->
t1;
208 *((uint16_t *) (res + 24)) = gs->
t7;
209 *((uint16_t *) (res + 26)) = gs->
t8;
211 *((uint32_t *) (res + 28)) = gs->
r;
212 *((uint32_t *) (res + 32)) = gs->
b;
213 *((uint32_t *) (res + 36)) = gs->
p;
214 *((uint32_t *) (res + 40)) = gs->
m;
215 *((uint32_t *) (res + 44)) = gs->
mm;
216 *((uint32_t *) (res + 48)) = gs->
rate;
217 *((uint32_t *) (res + 52)) = gs->
s;
222 uint32_t mtahost, uint32_t actcount,
float rate, uint32_t psizegateid,
235 *((uint16_t *) (p + offset)) = htons(trid);
245 *((uint32_t *) (p + offset)) = htonl(mtahost);
254 *((uint32_t *) (p + offset)) = htonl(gateid);
267 *((uint32_t *) (p + offset)) = htonl(actcount);
276 gs.
srcip = htonl(ssip);
277 gs.
dstip = htonl(mtahost);
278 gs.
srcp = htons(ssport);
282 gs.
t1 = htons(cmts->
t1);
283 gs.
t7 = htons(cmts->
t7);
284 gs.
t8 = htons(cmts->
t8);
288 gs.
m = htonl((uint32_t) psizegateid);
289 gs.
mm = htonl((uint32_t) psizegateid);
306 gs.
srcip = htonl(mtahost);
307 gs.
dstip = htonl(ssip);
309 gs.
dstp = htons(ssport);
328 uint16_t *ubuf = (uint16_t *) buf;
336 recmsg->
opcode = *(buf + 1);
337 recmsg->
clienttype = ntohs(*((uint16_t *) (buf + 2)));
338 recmsg->
length = ntohl(*((uint32_t *) (buf + 4)));
351 while (len < recmsg->
length) {
362 pobject = pobject->
next;
367 ast_debug(3,
"Too short object header len: %i\n", lent);
371 pobject->
length = ntohs(*ubuf);
372 pobject->
cnum = *(buf + 2);
373 pobject->
ctype = *(buf + 3);
379 ast_debug(3,
"Too short object content len: %i\n", lent);
407 *(buf + 1) = sendmsg->
opcode;
408 *((uint16_t *)(buf + 2)) = htons(sendmsg->
clienttype);
409 *((uint32_t *)(buf + 4)) = htonl(sendmsg->
length);
415 pobject = sendmsg->
object;
416 while(pobject !=
NULL) {
423 *(uint16_t *) (buf + bufpos) = htons(pobject->
length);
424 *(buf + bufpos + 2) = pobject->
cnum;
425 *(buf + bufpos + 3) = pobject->
ctype;
431 memcpy((buf + bufpos + 4), pobject->
contents, pobject->
length - 4);
432 bufpos += pobject->
length;
433 pobject = pobject->
next;
438 #ifdef HAVE_MSG_NOSIGNAL 439 #define SENDFLAGS MSG_NOSIGNAL | MSG_DONTWAIT 441 #define SENDFLAGS MSG_DONTWAIT 469 struct cops_gate *gate, uint32_t
mta, uint32_t actcount,
float bitrate,
470 uint32_t psize, uint32_t ssip, uint16_t ssport,
479 ast_debug(3,
"------- gate modify gateid 0x%x ssip: 0x%x\n", gate->
gateid, ssip);
485 ast_debug(3,
"COPS: Allocating gate for mta: 0x%x\n",
mta);
490 ast_debug(3,
"COPS: Couldn't allocate gate for mta: 0x%x\n",
mta);
496 uint16_t
trid, uint32_t
mta, uint32_t actcount,
float bitrate,
497 uint32_t psize, uint32_t ssip, uint16_t ssport,
struct cops_gate *gate)
514 if (mta >= ippool->
start && mta <= ippool->
stop) {
536 new->checked = time(
NULL);
537 new->allocated = time(
NULL);
539 new->got_dq_gi =
NULL;
540 new->gate_remove =
NULL;
541 new->gate_open =
NULL;
542 new->tech_pvt =
NULL;
635 cops_construct_gate(cmd, gateset->
object->
next->
next->
next->
contents, trid, mta, actcount, bitrate, psize, ssip, ssport, gate->
gateid, cmts);
638 cops_construct_gate(cmd, gateset->
object->
next->
next->
next->
contents, trid, mta, actcount, bitrate, psize, ssip, ssport, 0, cmts);
652 struct addrinfo hints;
655 #ifdef HAVE_SO_NOSIGPIPE 659 memset(&hints, 0,
sizeof(
struct addrinfo));
661 hints.ai_family = AF_UNSPEC;
662 hints.ai_socktype = SOCK_STREAM;
664 hints.ai_protocol = 0;
666 s = getaddrinfo(host, port, &hints, &result);
672 for (rp = result; rp !=
NULL; rp = rp->ai_next) {
673 sfd = socket(rp->ai_family, rp->ai_socktype, rp->ai_protocol);
678 #ifdef HAVE_SO_NOSIGPIPE 679 setsockopt(sfd, SOL_SOCKET, SO_NOSIGPIPE, &trueval,
sizeof(trueval));
681 connect(sfd, rp->ai_addr, rp->ai_addrlen);
686 freeaddrinfo(result);
688 ast_debug(3,
"Connecting to cmts: %s:%s\n", host, port);
692 #define PKTCCOPS_DESTROY_CURRENT_GATE \ 693 AST_LIST_REMOVE_CURRENT(list); \ 694 if (gate->gate_remove) { \ 695 gate->gate_remove(gate); \ 702 struct copsmsg *recmsg, *sendmsg;
703 struct copsmsg recmsgb, sendmsgb;
704 struct pollfd *pfds =
NULL, *
tmp;
709 uint16_t snst, sobjlen, scommand, recvtrid, actcount, reason, subreason;
710 uint32_t
gateid, subscrid, pktcerror;
711 time_t last_exec = 0;
724 if (last_exec != time(
NULL)) {
734 if (!(tmp =
ast_realloc(pfds, (nfds + 1) *
sizeof(*pfds)))) {
738 pfds[nfds].fd = cmts->
sfd;
739 pfds[nfds].events = POLLIN;
740 pfds[nfds].revents = 0;
747 if (!(tmp =
ast_realloc(pfds, (nfds + 1) *
sizeof(*pfds)))) {
751 pfds[nfds].fd = cmts->
sfd;
752 pfds[nfds].events = POLLIN;
753 pfds[nfds].revents = 0;
761 if (last_exec != time(
NULL)) {
762 last_exec = time(
NULL);
792 if ((res =
ast_poll(pfds, nfds, 1000))) {
799 ast_debug(3,
"COPS: got from %s:\n Header: versflag=0x%02hhx opcode=%i clienttype=0x%04hx msglength=%u\n",
804 while (pobject !=
NULL) {
806 if (recmsg->
opcode == 1 && pobject->
cnum == 1 && pobject->
ctype == 1 ) {
811 }
else if (pobject->
cnum == 9 && pobject->
ctype == 1) {
822 sobjlen = ntohs(*((uint16_t *) sobjp));
823 snst = ntohs(*((uint16_t *) (sobjp + 2)));
824 ast_debug(3,
" S-Num S-type: 0x%.4x len: %i\n", (
unsigned)snst, sobjlen);
825 if (snst == 0x0101 ) {
826 recvtrid = ntohs(*((uint16_t *) (sobjp + 4)));
827 scommand = ntohs(*((uint16_t *) (sobjp + 6)));
828 ast_debug(3,
" Transaction Identifier command: %i trid %i\n", scommand, recvtrid);
829 }
else if (snst == 0x0201) {
830 subscrid = ntohl(*((uint32_t *) (sobjp + 4)));
831 ast_debug(3,
" Subscriber ID: 0x%.8x\n", subscrid);
832 }
else if (snst == 0x0301) {
833 gateid = ntohl(*((uint32_t *) (sobjp + 4)));
834 ast_debug(3,
" Gate ID: 0x%x 0x%.8x\n", gateid, gateid);
835 }
else if (snst == 0x0401) {
836 actcount = ntohs(*((uint16_t *) (sobjp + 6)));
837 ast_debug(3,
" Activity Count: %i\n", actcount);
838 }
else if (snst == 0x0901) {
839 pktcerror = ntohl(*((uint32_t *) (sobjp + 4)));
840 ast_debug(3,
" PKTC Error: 0x%.8x\n", pktcerror);
841 }
else if (snst == 0x0d01) {
842 reason = ntohs(*((uint16_t *) (sobjp + 4)));
843 subreason = ntohs(*((uint16_t *) (sobjp + 6)));
844 ast_debug(3,
" Reason: %d Subreason: %d\n", reason, subreason);
853 if (gate->
cmts == cmts && gate->
gateid == gateid) {
855 ast_debug(3,
"COPS Gate Close Gate ID: 0x%x TrId: %i CMTS: %s\n", gateid, recvtrid, cmts->
name);
865 ast_debug(3,
"COPS Gate Open Gate ID: 0x%x TrId: %i CMTS: %s\n", gateid, recvtrid, cmts->
name);
868 ast_debug(3,
"Calling GATE-OPEN callback function\n");
881 if (gate->
cmts == cmts && gate->
trid == recvtrid) {
885 ast_debug(3,
"COPS Gate Set Ack Gate ID: 0x%x TrId: %i CMTS: %s\n", gateid, recvtrid, cmts->
name);
892 ast_debug(3,
"COPS Gate Set Error TrId: %i ErrorCode: 0x%.8x CMTS: %s\n ", recvtrid, pktcerror, cmts->
name);
900 ast_debug(3,
"COPS Gate Info Ack Gate ID: 0x%x TrId: %i CMTS: %s\n", gateid, recvtrid, cmts->
name);
902 ast_debug(3,
"COPS Gate Info Error Gate ID: 0x%x TrId: %i CMTS: %s\n", gateid, recvtrid, cmts->
name);
906 ast_debug(3,
"COPS Gate Deleted Gate ID: 0x%x TrId: %i CMTS: %s\n", gateid, recvtrid, cmts->
name);
918 pobject = pobject->
next;
938 }
else if (recmsg->
opcode == 9) {
939 ast_debug(3,
"COPS: Keepalive Request got echoing back %s\n", cmts->
name);
968 if (gate->
cmts == cmts) {
988 pthread_testcancel();
1024 static char *cfg =
"res_pktccops.conf";
1029 const char *
host, *cat, *port;
1032 uint16_t t1_temp, t7_temp, t8_temp;
1033 uint32_t keepalive_temp;
1034 unsigned int a,
b,
c,
d,e,f,g,h;
1042 if (!strcmp(cat,
"general")) {
1044 if (!strcasecmp(v->
name,
"t1")) {
1046 }
else if (!strcasecmp(v->
name,
"t7")) {
1048 }
else if (!strcasecmp(v->
name,
"t8")) {
1050 }
else if (!strcasecmp(v->
name,
"keepalive")) {
1052 }
else if (!strcasecmp(v->
name,
"gateinfoperiod")) {
1054 }
else if (!strcasecmp(v->
name,
"gatetimeout")) {
1070 if (!strcasecmp(v->
name,
"host")) {
1072 }
else if (!strcasecmp(v->
name,
"port")) {
1074 }
else if (!strcasecmp(v->
name,
"t1")) {
1075 t1_temp = atoi(v->
value);
1076 }
else if (!strcasecmp(v->
name,
"t7")) {
1077 t7_temp = atoi(v->
value);
1078 }
else if (!strcasecmp(v->
name,
"t8")) {
1079 t8_temp = atoi(v->
value);
1080 }
else if (!strcasecmp(v->
name,
"keepalive")) {
1081 keepalive_temp = atoi(v->
value);
1082 }
else if (!strcasecmp(v->
name,
"pool")) {
1091 if (!strcmp(cmts->
name, cat)) {
1128 if (!strcasecmp(v->
name,
"pool")) {
1129 if (sscanf(v->
value,
"%3u.%3u.%3u.%3u %3u.%3u.%3u.%3u", &a, &b, &c, &d, &e, &f, &g, &h) == 8) {
1130 new_ippool =
ast_calloc(1,
sizeof(*new_ippool));
1135 new_ippool->
start = a << 24 | b << 16 | c << 8 |
d;
1136 new_ippool->
stop = e << 24 | f << 16 | g << 8 | h;
1137 new_ippool->
cmts = cmts;
1158 e->
command =
"pktccops show cmtses";
1160 "Usage: pktccops show cmtses\n" 1161 " List PacketCable COPS CMTSes.\n";
1168 ast_cli(a->
fd,
"%-16s %-24s %-12s %7s\n",
"Name ",
"Host ",
"Status ",
"KA timer ");
1169 ast_cli(a->
fd,
"%-16s %-24s %-12s %7s\n",
"------------",
"--------------------",
"----------",
"-----------");
1173 if (cmts->
state == 2) {
1176 }
else if (cmts->
state == 1) {
1181 ast_cli(a->
fd,
"%-16s %-15s:%-8s %-12s %-7d\n", cmts->
name, cmts->
host, cmts->
port, statedesc, katimer);
1190 char state_desc[16];
1194 e->
command =
"pktccops show gates";
1196 "Usage: pktccops show gates\n" 1197 " List PacketCable COPS GATEs.\n";
1204 ast_cli(a->
fd,
"%-16s %-12s %-12s %-10s %-10s %-10s\n" ,
"CMTS",
"Gate-Id",
"MTA",
"Status",
"AllocTime",
"CheckTime");
1205 ast_cli(a->
fd,
"%-16s %-12s %-12s %-10s %-10s %-10s\n" ,
"--------------" ,
"----------",
"----------",
"--------",
"--------",
"--------\n");
1243 e->
command =
"pktccops show pools";
1245 "Usage: pktccops show pools\n" 1246 " List PacketCable COPS ip pools of MTAs.\n";
1253 ast_cli(a->
fd,
"%-16s %-18s %-7s\n",
"Start ",
"Stop ",
"CMTS ");
1254 ast_cli(a->
fd,
"%-16s %-18s %-7s\n",
"----------",
"----------",
"--------");
1257 snprintf(start,
sizeof(start),
"%3u.%3u.%3u.%3u", ippool->
start >> 24, (ippool->
start >> 16) & 0x000000ff, (ippool->
start >> 8) & 0x000000ff, ippool->
start & 0x000000ff);
1259 snprintf(stop,
sizeof(stop),
"%3u.%3u.%3u.%3u", ippool->
stop >> 24, (ippool->
stop >> 16) & 0x000000ff, (ippool->
stop >> 8) & 0x000000ff, ippool->
stop & 0x000000ff);
1276 e->
command =
"pktccops gatedel";
1278 "Usage: pktccops gatedel <cmts> <gateid>\n" 1279 " Send Gate-Del to cmts.\n";
1290 if (!strcmp(cmts->
name, a->
argv[2])) {
1302 if (!sscanf(a->
argv[3],
"%x", &gateid)) {
1303 ast_cli(a->
fd,
"bad gate specification (%s)\n", a->
argv[3]);
1310 if (gate->
gateid == gateid && gate->
cmts == cmts) {
1330 unsigned int an,bn,cn,dn;
1336 e->
command =
"pktccops gateset";
1338 "Usage: pktccops gateset <cmts> <mta> <acctcount> <bitrate> <packet size> <switch ip> <switch port>\n" 1339 " Send Gate-Set to cmts.\n";
1348 if (!strcmp(a->
argv[2],
"null")) {
1353 if (!strcmp(cmts->
name, a->
argv[2])) {
1367 if (sscanf(a->
argv[3],
"%3u.%3u.%3u.%3u", &an, &bn, &cn, &dn) != 4) {
1368 ast_cli(a->
fd,
"MTA specification (%s) does not look like an ipaddr\n", a->
argv[3]);
1371 mta = an << 24 | bn << 16 | cn << 8 | dn;
1373 if (sscanf(a->
argv[7],
"%3u.%3u.%3u.%3u", &an, &bn, &cn, &dn) != 4) {
1374 ast_cli(a->
fd,
"SSIP specification (%s) does not look like an ipaddr\n", a->
argv[7]);
1377 ssip = an << 24 | bn << 16 | cn << 8 | dn;
1387 e->
command =
"pktccops set debug {on|off}";
1389 "Usage: pktccops set debug {on|off}\n" 1390 " Turn on/off debuging\n";
1398 if (!strncasecmp(a->
argv[e->
args - 1],
"on", 2)) {
1400 ast_cli(a->
fd,
"PktcCOPS Debugging Enabled\n");
1401 }
else if (!strncasecmp(a->
argv[e->
args - 1],
"off", 2)) {
1403 ast_cli(a->
fd,
"PktcCOPS Debugging Disabled\n");
1439 if (cmts->
sfd > 0) {
struct ast_variable * next
#define AST_CLI_DEFINE(fn, txt,...)
#define AST_LIST_LOCK(head)
Locks a list.
Asterisk locking-related definitions:
Asterisk main include file. File version handling, generic pbx functions.
#define ast_realloc(p, len)
A wrapper for realloc()
static int pktccops_add_ippool(struct cops_ippool *ippool)
static int load_module(void)
static int cops_sendmsg(int sfd, struct copsmsg *sendmsg)
static uint32_t keepalive
int ast_cli_unregister_multiple(struct ast_cli_entry *e, int len)
Unregister multiple commands.
#define PKTCCOPS_SCOMMAND_GATE_SET_ERR
struct ast_variable * ast_variable_browse(const struct ast_config *config, const char *category_name)
static int cops_connect(char *host, char *port)
#define PKTCCOPS_SCOMMAND_GATE_DELETE
static void update(int code_size, int y, int wi, int fi, int dq, int sr, int dqsez, struct g726_state *state_ptr)
struct cops_gate *AST_OPTIONAL_API_NAME() ast_pktccops_gate_alloc(int cmd, struct cops_gate *gate, uint32_t mta, uint32_t actcount, float bitrate, uint32_t psize, uint32_t ssip, uint16_t ssport, int(*const got_dq_gi)(struct cops_gate *gate), int(*const gate_remove)(struct cops_gate *gate))
static int gateinfoperiod
Time-related functions and macros.
struct cops_ippool::@490 list
static ast_mutex_t pktccops_lock
static pthread_t pktccops_thread
static void cops_freemsg(struct copsmsg *p)
descriptor for a cli entry.
#define AST_LIST_UNLOCK(head)
Attempts to unlock a list.
#define PKTCCOPS_DESTROY_CURRENT_GATE
Structure for variables, used for configurations and for channel variables.
#define ast_cli_register_multiple(e, len)
Register multiple commands.
static struct ast_cli_entry cli_pktccops[]
static char * pktccops_debug(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
#define ast_mutex_lock(a)
static char * pktccops_gatedel(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
#define PKTCCOPS_SCOMMAND_GATE_INFO_ACK
Generic File Format Support. Should be included by clients of the file handling routines. File service providers should instead include mod_format.h.
char * ast_category_browse(struct ast_config *config, const char *prev_name)
Browse categories.
void ast_cli(int fd, const char *fmt,...)
#define AST_LIST_TRAVERSE_SAFE_END
Closes a safe loop traversal block.
static struct cops_gate * cops_gate_cmd(int cmd, struct cops_cmts *cmts, uint16_t trid, uint32_t mta, uint32_t actcount, float bitrate, uint32_t psize, uint32_t ssip, uint16_t ssport, struct cops_gate *gate)
struct cops_cmts::@489 list
int args
This gets set in ast_cli_register()
#define PKTCCOPS_SCOMMAND_GATE_INFO_ERR
#define PKTCCOPS_SCOMMAND_GATE_DELETE_ACK
#define ast_pthread_create_background(a, b, c, d)
#define PKTCCOPS_SCOMMAND_GATE_OPEN
Configuration File Parser.
#define ast_fd_set_flags(fd, flags)
Set flags on the given file descriptor.
#define ast_debug(level,...)
Log a DEBUG message.
static int unload_module(void)
#define ast_config_load(filename, flags)
Load a config file.
#define GATE_SET_OBJ_SIZE
General Asterisk PBX channel definitions.
static uint32_t ftoieeef(float n)
static uint16_t cops_constructgatespec(struct gatespec *gs, char *res)
#define AST_PTHREADT_NULL
#define ast_poll(a, b, c)
#define PKTCCOPS_SCOMMAND_GATE_SET
#define AST_LIST_REMOVE_CURRENT(field)
Removes the current entry from a list during a traversal.
void ast_config_destroy(struct ast_config *config)
Destroys a config.
#define COPS_OBJECT_HEADER_SIZE
#define GATE_INFO_OBJ_SIZE
#define ast_malloc(len)
A wrapper for malloc()
#define AST_LIST_REMOVE_HEAD(head, field)
Removes and returns the head entry from a list.
Core PBX routines and definitions.
#define AST_LIST_HEAD_STATIC(name, type)
Defines a structure to be used to hold a list of specified type, statically initialized.
static int load_pktccops_config(void)
#define PKTCCOPS_SCOMMAND_GATE_SET_ACK
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
static int ast_poll_fd_index(struct pollfd *haystack, int nfds, int needle)
Shortcut for conversion of FD_ISSET to poll(2)-based.
int(* gate_open)(struct cops_gate *gate)
static uint16_t cops_trid
static void * do_pktccops(void *data)
#define AST_LIST_TRAVERSE(head, var, field)
Loops over (traverses) the entries in a list.
#define AST_LIST_ENTRY(type)
Declare a forward link structure inside a list entry.
#define AST_LIST_INSERT_HEAD(head, elm, field)
Inserts a list entry at the head of a list.
#define ast_calloc(num, len)
A wrapper for calloc()
Module has failed to load, may be in an inconsistent state.
int(* gate_remove)(struct cops_gate *gate)
Structure used to handle boolean flags.
#define PKTCCOPS_SCOMMAND_GATE_INFO
#define PKTCCOPS_SCOMMAND_GATE_CLOSE
Support for logging to various files, console and syslog Configuration in file logger.conf.
static char * pktccops_show_pools(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS|AST_MODFLAG_LOAD_ORDER, "HTTP Phone Provisioning",.support_level=AST_MODULE_SUPPORT_EXTENDED,.load=load_module,.unload=unload_module,.reload=reload,.load_pri=AST_MODPRI_CHANNEL_DEPEND,.requires="http",)
static char * pktccops_gateset(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
Standard Command Line Interface.
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
static char * pktccops_show_cmtses(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
#define AST_PTHREADT_STOP
static int reload_module(void)
static void pktccops_unregister_cmtses(void)
Options provided by main asterisk program.
static void pktccops_unregister_ippools(void)
#define AST_LIST_TRAVERSE_SAFE_BEGIN(head, var, field)
Loops safely over (traverses) the entries in a list.
#define AST_OPTIONAL_API_NAME(name)
Expands to the name of the implementation function.
#define DEFAULT_COPS_PORT
static int cops_getmsg(int sfd, struct copsmsg *recmsg)
#define ASTERISK_GPL_KEY
The text the key() function should return.
Asterisk module definitions.
struct ast_cli_entry::@250 list
int(* got_dq_gi)(struct cops_gate *gate)
#define AST_MUTEX_DEFINE_STATIC(mutex)
static int restart_pktc_thread(void)
static uint16_t cops_construct_gate(int cmd, char *p, uint16_t trid, uint32_t mtahost, uint32_t actcount, float rate, uint32_t psizegateid, uint32_t ssip, uint16_t ssport, uint32_t gateid, struct cops_cmts *cmts)
static char * pktccops_show_gates(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
#define ast_mutex_unlock(a)