manager.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
#ifndef _ASTERISK_MANAGER_H
00018
#define _ASTERISK_MANAGER_H
00019
00020
#include <stdarg.h>
00021
#include <sys/types.h>
00022
#include <sys/socket.h>
00023
#include <netinet/in.h>
00024
#include <arpa/inet.h>
00025
00026
#include <asterisk/lock.h>
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042 #define DEFAULT_MANAGER_PORT 5038
00043
00044 #define EVENT_FLAG_SYSTEM (1 << 0)
00045 #define EVENT_FLAG_CALL (1 << 1)
00046 #define EVENT_FLAG_LOG (1 << 2)
00047 #define EVENT_FLAG_VERBOSE (1 << 3)
00048 #define EVENT_FLAG_COMMAND (1 << 4)
00049 #define EVENT_FLAG_AGENT (1 << 5)
00050 #define EVENT_FLAG_USER (1 << 6)
00051
00052
00053 #define MAX_HEADERS 80
00054 #define MAX_LEN 256
00055
00056 struct mansession {
00057 pthread_t
t;
00058 ast_mutex_t lock;
00059 struct sockaddr_in sin;
00060 int fd;
00061 int blocking;
00062 char username[80];
00063 char challenge[10];
00064 int authenticated;
00065 int readperm;
00066 int writeperm;
00067 char inbuf[
MAX_LEN];
00068 int inlen;
00069 int send_events;
00070 struct mansession *
next;
00071 };
00072
00073
00074 struct message {
00075 int hdrcount;
00076 char headers[
MAX_HEADERS][
MAX_LEN];
00077 };
00078
00079 struct manager_action {
00080
00081 char *
action;
00082
00083 char *
synopsis;
00084
00085 char *
description;
00086
00087 int authority;
00088
00089 int (*func)(
struct mansession *
s,
struct message *m);
00090
00091 struct manager_action *
next;
00092 };
00093
00094
int ast_carefulwrite(
int fd,
char *s,
int len,
int timeoutms);
00095
00096
00097 #define ast_manager_register(a, b, c, d) ast_manager_register2(a, b, c, d, NULL)
00098
int ast_manager_register2(
char *action,
int authority,
00099
int (*func)(
struct mansession *s,
struct message *m),
char *synopsis,
char *description);
00100
int ast_manager_unregister(
char *action );
00101
00102
00103
extern int manager_event(
int category,
char *event,
char *contents, ...)
00104 __attribute__ ((format (printf, 3,4)));
00105
00106 extern
char *astman_get_header(struct
message *m,
char *var);
00107 extern
void astman_send_error(struct
mansession *s, struct
message *m,
char *error);
00108 extern
void astman_send_response(struct
mansession *s, struct
message *m,
char *resp,
char *msg);
00109 extern
void astman_send_ack(struct
mansession *s, struct
message *m,
char *msg);
00110
00111
00112 extern
int init_manager(
void);
00113 extern
int reload_manager(
void);
00114 #endif
Generated on Sat Jun 12 16:40:58 2004 for Asterisk by
1.3.7