initial checkin of experiments with python and the MNCC interface

This commit is contained in:
Harald Welte 2015-12-01 19:07:30 +01:00
commit 3d66bfbeee
9 changed files with 2109 additions and 0 deletions

138
gsm_call_fsm.py Normal file
View File

@ -0,0 +1,138 @@
#!/usr/bin/python
import mncc
import ctypes
import pykka
from fysom import Fysom
from mncc_sock import mncc_msg, mncc_number
class GsmCallFsm(object):
last_callref = 0
def get_next_callref(self):
GsmCallFsm.last_callref = GsmCallFsm.last_callref + 1
return GsmCallFsm.last_callref;
def printstatechange(self, e):
print 'GsmCallFsm(%s): event: %s, src: %s, dst: %s' % (self.name, e.event, e.src, e.dst)
def onmncc_setup_req(self, e):
msg = mncc_msg(msg_type = mncc.MNCC_SETUP_REQ, callref = self.callref,
fields = mncc.MNCC_F_CALLED | mncc.MNCC_F_CALLING,
calling = mncc_number(self.calling),
called = mncc_number(self.called))
self.mncc.send(msg)
print 'GsmCallFsm(%s): mncc_setup_req event: %s, src: %s, dst: %s' % (self.name, e.event, e.src, e.dst)
def onmncc_setup_cnf(self, e):
# send MNCC_SETUP_COMPL_REQ to MNCC interface, causing
# CC-CONNECT-ACK to be sent to MS
msg = mncc_msg(msg_type = mncc.MNCC_SETUP_COMPL_REQ)
self.mncc.send(msg)
def __init__(self, name, mncc):
self.name = name
self.mncc = mncc;
self.callref = self.get_next_callref()
self.fsm = Fysom(initial = 'NULL',
events = [
# MT call setup
('mncc_setup_req', 'NULL', 'CALL_PRESENT'),
('mncc_rel_ind', 'CALL_PRESENT', 'NULL'),
('mncc_call_conf_ind', 'CALL_PRESENT', 'MT_CALL_CONFIRMED'),
('mncc_alert_ind', 'MT_CALL_CONFIRMED', 'CALL_RECEIVED'),
('mncc_setup_cnf', 'CALL_RECEIVED', 'CONNECT_REQUEST'),
('mncc_setup_cnf', 'MT_CALL_CONFIRMED', 'CONNECT_REQUEST'),
('mncc_setup_compl_req', 'CONNECT_REQUEST', 'ACTIVE'),
# MO call setup
# SETUP INDICATION (MS->MNCC)
('mncc_setup_ind', 'NULL', 'CALL_INIT'),
# CALL PROCEEDING REQ (MNCC->MS)
('mncc_call_proc_req', 'CALL_INIT', 'MO_CALL_PROC'),
# SETUP RESPONSE (MS->MNCC)
('mncc_setup_resp', 'MO_CALL_PROC', 'CONNECT_INDICATION'),
# ALERT REQ (MNCC->MS)
('mncc_alert_req', 'MO_CALL_PROC', 'CALL_DELIVERED'),
# SETUP RESPONSE (MS->MNCC)
('mncc_setup_resp', 'CALL_DELIVERED', 'CONNECT_INDICATION'),
# PROGRESS REQ (MNCC->MS)
('mncc_progress_req', 'MO_CALL_PROC', 'MO_CALL_PROC'),
# SETUP COMPL IND (MS->MNCC)
('mncc_setup_compl_ind', 'CONNECT_INDICATION', 'ACTIVE'),
('mncc_disc_ind', ['CALL_INIT', 'MO_CALL_PROC',
'CALL_RECEIVED', 'CONNECT_REQUEST',
'MT_CALL_CONFIRMED', 'ACTIVE',
'CONNECT_INDICATION'], 'RELEASE_REQUEST'),
('mncc_disc_req', ['CALL_INIT', 'MO_CALL_PROC',
'CALL_RECEIVED', 'CONNECT_REQUEST',
'MT_CALL_CONFIRMED', 'ACTIVE',
'CONNECT_INDICATION'], 'DISCONNECT_INDICATION'),
('mncc_rel_ind', 'DISCONNECT_INDICATION', 'NULL'),
('mncc_disc_ind', 'DISCONNECT_INDICATION', 'RELEASE_REQUEST'),
('mncc_rel_cnf', 'RELEASE_REQUEST', 'NULL')
],
callbacks = [('onmncc_setup_req', self.onmncc_setup_req),
('onmncc_setup_cnf', self.onmncc_setup_cnf),
],
)
self.fsm.onchangestate = self.printstatechange
def start_mt_call(self, calling, called):
self.calling = calling
self.called = called
self.fsm.mncc_setup_req()
# MT call
def do_mncc_rel_ind(self, mncc_msg):
self.fsm.mncc_rel_ind(mncc_msg)
def do_mncc_call_conf_ind(self, mncc_msg):
self.fsm.mncc_call_conf_ind(mncc_msg)
def do_mncc_alert_ind(self, mncc_msg):
self.fsm.mncc_allert_ind(mncc_msg)
def do_mncc_setup_cnf(self, mncc_msg):
self.fsm.mncc_setup_cnf(mncc_msg)
# MO call
def do_mncc_setup_ind(self, mncc_msg):
self.fsm.mncc_setup_ind(mncc_msg)
def do_mncc_setup_compl_ind(self, mncc_msg):
self.fsm.mncc_setup_compl_ind(mncc_msg)
# Misc
def do_mncc_disc_ind(self, mncc_msg):
self.fsm.mncc_disc_ind(mncc_msg)
def do_mncc_rel_ind(self, mncc_msg):
self.fsm.mncc_rel_ind(mncc_msg)
def do_mncc_rel_cnf(self, mncc_msg):
self.fsm.mncc_rel_cnf(mncc_msg)
func_by_type = {
# MT call
mncc.MNCC_REL_IND: do_mncc_rel_ind,
mncc.MNCC_CALL_CONF_IND: do_mncc_call_conf_ind,
mncc.MNCC_ALERT_IND: do_mncc_alert_ind,
mncc.MNCC_SETUP_CNF: do_mncc_setup_cnf,
# MO call
mncc.MNCC_SETUP_IND: do_mncc_setup_ind,
mncc.MNCC_SETUP_COMPL_IND: do_mncc_setup_compl_ind,
# misc
mncc.MNCC_DISC_IND: do_mncc_disc_ind,
mncc.MNCC_REL_IND: do_mncc_rel_ind,
mncc.MNCC_REL_CNF: do_mncc_rel_cnf,
}
def lookup_method(self, mncc_msg_type):
return self.func_by_type[mncc_msg_type]
def handle_mncc(self, mncc_msg):
if mncc_msg.callref != self.callref:
raise Exception('mncc', 'Callref not for this GsmCallFsm')
self.lookup_method(mncc_msg.msg_type)(self, mncc_msg)

293
mncc.h Normal file
View File

@ -0,0 +1,293 @@
#include <stdint.h>
/* GSM 04.08 Bearer Capability: Rate Adaption */
enum gsm48_bcap_ra {
GSM48_BCAP_RA_NONE = 0,
GSM48_BCAP_RA_V110_X30 = 1,
GSM48_BCAP_RA_X31 = 2,
GSM48_BCAP_RA_OTHER = 3,
};
/* GSM 04.08 Bearer Capability: Signalling access protocol */
enum gsm48_bcap_sig_access {
GSM48_BCAP_SA_I440_I450 = 1,
GSM48_BCAP_SA_X21 = 2,
GSM48_BCAP_SA_X28_DP_IN = 3,
GSM48_BCAP_SA_X28_DP_UN = 4,
GSM48_BCAP_SA_X28_NDP = 5,
GSM48_BCAP_SA_X32 = 6,
};
/* GSM 04.08 Bearer Capability: User Rate */
enum gsm48_bcap_user_rate {
GSM48_BCAP_UR_300 = 1,
GSM48_BCAP_UR_1200 = 2,
GSM48_BCAP_UR_2400 = 3,
GSM48_BCAP_UR_4800 = 4,
GSM48_BCAP_UR_9600 = 5,
GSM48_BCAP_UR_12000 = 6,
GSM48_BCAP_UR_1200_75 = 7,
};
/* GSM 04.08 Bearer Capability: Parity */
enum gsm48_bcap_parity {
GSM48_BCAP_PAR_ODD = 0,
GSM48_BCAP_PAR_EVEN = 2,
GSM48_BCAP_PAR_NONE = 3,
GSM48_BCAP_PAR_ZERO = 4,
GSM48_BCAP_PAR_ONE = 5,
};
/* GSM 04.08 Bearer Capability: Intermediate Rate */
enum gsm48_bcap_interm_rate {
GSM48_BCAP_IR_8k = 2,
GSM48_BCAP_IR_16k = 3,
};
/* GSM 04.08 Bearer Capability: Transparency */
enum gsm48_bcap_transp {
GSM48_BCAP_TR_TRANSP = 0,
GSM48_BCAP_TR_RLP = 1,
GSM48_BCAP_TR_TR_PREF = 2,
GSM48_BCAP_TR_RLP_PREF = 3,
};
/* GSM 04.08 Bearer Capability: Modem Type */
enum gsm48_bcap_modem_type {
GSM48_BCAP_MT_NONE = 0,
GSM48_BCAP_MT_V21 = 1,
GSM48_BCAP_MT_V22 = 2,
GSM48_BCAP_MT_V22bis = 3,
GSM48_BCAP_MT_V23 = 4,
GSM48_BCAP_MT_V26ter = 5,
GSM48_BCAP_MT_V32 = 6,
GSM48_BCAP_MT_UNDEF = 7,
GSM48_BCAP_MT_AUTO_1 = 8,
};
#define GSM_MAX_FACILITY 128
#define GSM_MAX_SSVERSION 128
#define GSM_MAX_USERUSER 128
/* Expanded fields from GSM TS 04.08, Table 10.5.102 */
struct gsm_mncc_bearer_cap {
int transfer; /* Information Transfer Capability */
int mode; /* Transfer Mode */
int coding; /* Coding Standard */
int radio; /* Radio Channel Requirement */
int speech_ctm; /* CTM text telephony indication */
int speech_ver[8]; /* Speech version indication */
struct {
enum gsm48_bcap_ra rate_adaption;
enum gsm48_bcap_sig_access sig_access;
int async;
int nr_stop_bits;
int nr_data_bits;
enum gsm48_bcap_user_rate user_rate;
enum gsm48_bcap_parity parity;
enum gsm48_bcap_interm_rate interm_rate;
enum gsm48_bcap_transp transp;
enum gsm48_bcap_modem_type modem_type;
} data;
};
struct gsm_mncc_number {
int type;
int plan;
int present;
int screen;
char number[33];
};
struct gsm_mncc_cause {
int location;
int coding;
int rec;
int rec_val;
int value;
int diag_len;
char diag[32];
};
struct gsm_mncc_useruser {
int proto;
char info[GSM_MAX_USERUSER + 1]; /* + termination char */
};
struct gsm_mncc_progress {
int coding;
int location;
int descr;
};
struct gsm_mncc_facility {
int len;
char info[GSM_MAX_FACILITY];
};
struct gsm_mncc_ssversion {
int len;
char info[GSM_MAX_SSVERSION];
};
struct gsm_mncc_cccap {
int dtmf;
int pcp;
};
enum {
GSM_MNCC_BCAP_SPEECH = 0,
GSM_MNCC_BCAP_UNR_DIG = 1,
GSM_MNCC_BCAP_AUDIO = 2,
GSM_MNCC_BCAP_FAX_G3 = 3,
GSM_MNCC_BCAP_OTHER_ITC = 5,
GSM_MNCC_BCAP_RESERVED = 7,
};
#define MNCC_SETUP_REQ 0x0101
#define MNCC_SETUP_IND 0x0102
#define MNCC_SETUP_RSP 0x0103
#define MNCC_SETUP_CNF 0x0104
#define MNCC_SETUP_COMPL_REQ 0x0105
#define MNCC_SETUP_COMPL_IND 0x0106
/* MNCC_REJ_* is perfomed via MNCC_REL_* */
#define MNCC_CALL_CONF_IND 0x0107
#define MNCC_CALL_PROC_REQ 0x0108
#define MNCC_PROGRESS_REQ 0x0109
#define MNCC_ALERT_REQ 0x010a
#define MNCC_ALERT_IND 0x010b
#define MNCC_NOTIFY_REQ 0x010c
#define MNCC_NOTIFY_IND 0x010d
#define MNCC_DISC_REQ 0x010e
#define MNCC_DISC_IND 0x010f
#define MNCC_REL_REQ 0x0110
#define MNCC_REL_IND 0x0111
#define MNCC_REL_CNF 0x0112
#define MNCC_FACILITY_REQ 0x0113
#define MNCC_FACILITY_IND 0x0114
#define MNCC_START_DTMF_IND 0x0115
#define MNCC_START_DTMF_RSP 0x0116
#define MNCC_START_DTMF_REJ 0x0117
#define MNCC_STOP_DTMF_IND 0x0118
#define MNCC_STOP_DTMF_RSP 0x0119
#define MNCC_MODIFY_REQ 0x011a
#define MNCC_MODIFY_IND 0x011b
#define MNCC_MODIFY_RSP 0x011c
#define MNCC_MODIFY_CNF 0x011d
#define MNCC_MODIFY_REJ 0x011e
#define MNCC_HOLD_IND 0x011f
#define MNCC_HOLD_CNF 0x0120
#define MNCC_HOLD_REJ 0x0121
#define MNCC_RETRIEVE_IND 0x0122
#define MNCC_RETRIEVE_CNF 0x0123
#define MNCC_RETRIEVE_REJ 0x0124
#define MNCC_USERINFO_REQ 0x0125
#define MNCC_USERINFO_IND 0x0126
#define MNCC_REJ_REQ 0x0127
#define MNCC_REJ_IND 0x0128
#define MNCC_BRIDGE 0x0200
#define MNCC_FRAME_RECV 0x0201
#define MNCC_FRAME_DROP 0x0202
#define MNCC_LCHAN_MODIFY 0x0203
#define MNCC_RTP_CREATE 0x0204
#define MNCC_RTP_CONNECT 0x0205
#define MNCC_RTP_FREE 0x0206
#define GSM_TCHF_FRAME 0x0300
#define GSM_TCHF_FRAME_EFR 0x0301
#define GSM_TCHH_FRAME 0x0302
#define GSM_TCH_FRAME_AMR 0x0303
#define GSM_BAD_FRAME 0x03ff
#define MNCC_SOCKET_HELLO 0x0400
#define GSM_MAX_FACILITY 128
#define GSM_MAX_SSVERSION 128
#define GSM_MAX_USERUSER 128
#define MNCC_F_BEARER_CAP 0x0001
#define MNCC_F_CALLED 0x0002
#define MNCC_F_CALLING 0x0004
#define MNCC_F_REDIRECTING 0x0008
#define MNCC_F_CONNECTED 0x0010
#define MNCC_F_CAUSE 0x0020
#define MNCC_F_USERUSER 0x0040
#define MNCC_F_PROGRESS 0x0080
#define MNCC_F_EMERGENCY 0x0100
#define MNCC_F_FACILITY 0x0200
#define MNCC_F_SSVERSION 0x0400
#define MNCC_F_CCCAP 0x0800
#define MNCC_F_KEYPAD 0x1000
#define MNCC_F_SIGNAL 0x2000
struct gsm_mncc {
/* context based information */
uint32_t msg_type;
uint32_t callref;
/* which fields are present */
uint32_t fields;
/* data derived informations (MNCC_F_ based) */
struct gsm_mncc_bearer_cap bearer_cap;
struct gsm_mncc_number called;
struct gsm_mncc_number calling;
struct gsm_mncc_number redirecting;
struct gsm_mncc_number connected;
struct gsm_mncc_cause cause;
struct gsm_mncc_progress progress;
struct gsm_mncc_useruser useruser;
struct gsm_mncc_facility facility;
struct gsm_mncc_cccap cccap;
struct gsm_mncc_ssversion ssversion;
struct {
int sup;
int inv;
} clir;
int signal;
/* data derived information, not MNCC_F based */
int keypad;
int more;
int notify; /* 0..127 */
int emergency;
char imsi[16];
unsigned char lchan_type;
unsigned char lchan_mode;
};
struct gsm_data_frame {
uint32_t msg_type;
uint32_t callref;
unsigned char data[0];
};
#define MNCC_SOCK_VERSION 5
struct gsm_mncc_hello {
uint32_t msg_type;
uint32_t version;
/* send the sizes of the structs */
uint32_t mncc_size;
uint32_t data_frame_size;
/* send some offsets */
uint32_t called_offset;
uint32_t signal_offset;
uint32_t emergency_offset;
uint32_t lchan_type_offset;
};
struct gsm_mncc_rtp {
uint32_t msg_type;
uint32_t callref;
uint32_t ip;
uint16_t port;
uint32_t payload_type;
uint32_t payload_msg_type;
};

498
mncc.py Normal file
View File

@ -0,0 +1,498 @@
from ctypes import *
GSM48_BCAP_UR_300 = 1
GSM48_BCAP_MT_AUTO_1 = 8
GSM48_BCAP_PAR_EVEN = 2
GSM48_BCAP_PAR_ONE = 5
GSM48_BCAP_UR_4800 = 4
GSM48_BCAP_TR_TR_PREF = 2
GSM48_BCAP_SA_X32 = 6
GSM48_BCAP_SA_X28_NDP = 5
GSM48_BCAP_SA_X28_DP_UN = 4
GSM48_BCAP_PAR_ODD = 0
GSM48_BCAP_SA_X28_DP_IN = 3
GSM48_BCAP_SA_X21 = 2
GSM48_BCAP_UR_2400 = 3
GSM48_BCAP_SA_I440_I450 = 1
GSM48_BCAP_IR_16k = 3
GSM48_BCAP_MT_V26ter = 5
GSM_MNCC_BCAP_SPEECH = 0
GSM48_BCAP_MT_V32 = 6
GSM48_BCAP_MT_V22bis = 3
GSM48_BCAP_TR_RLP = 1
GSM48_BCAP_MT_V22 = 2
GSM48_BCAP_MT_UNDEF = 7
GSM48_BCAP_MT_V23 = 4
GSM48_BCAP_TR_RLP_PREF = 3
GSM48_BCAP_TR_TRANSP = 0
GSM48_BCAP_PAR_ZERO = 4
GSM48_BCAP_MT_V21 = 1
GSM_MNCC_BCAP_AUDIO = 2
GSM48_BCAP_MT_NONE = 0
GSM48_BCAP_UR_1200_75 = 7
GSM48_BCAP_UR_12000 = 6
GSM_MNCC_BCAP_FAX_G3 = 3
GSM48_BCAP_UR_9600 = 5
GSM48_BCAP_IR_8k = 2
GSM_MNCC_BCAP_UNR_DIG = 1
GSM48_BCAP_PAR_NONE = 3
GSM48_BCAP_RA_OTHER = 3
GSM48_BCAP_RA_X31 = 2
GSM48_BCAP_RA_V110_X30 = 1
GSM48_BCAP_RA_NONE = 0
GSM_MNCC_BCAP_RESERVED = 7
GSM_MNCC_BCAP_OTHER_ITC = 5
GSM48_BCAP_UR_1200 = 2
# values for enumeration 'gsm48_bcap_ra'
gsm48_bcap_ra = c_int # enum
# values for enumeration 'gsm48_bcap_sig_access'
gsm48_bcap_sig_access = c_int # enum
# values for enumeration 'gsm48_bcap_user_rate'
gsm48_bcap_user_rate = c_int # enum
# values for enumeration 'gsm48_bcap_parity'
gsm48_bcap_parity = c_int # enum
# values for enumeration 'gsm48_bcap_interm_rate'
gsm48_bcap_interm_rate = c_int # enum
# values for enumeration 'gsm48_bcap_transp'
gsm48_bcap_transp = c_int # enum
# values for enumeration 'gsm48_bcap_modem_type'
gsm48_bcap_modem_type = c_int # enum
class gsm_mncc_bearer_cap(Structure):
pass
class N19gsm_mncc_bearer_cap3DOT_0E(Structure):
pass
N19gsm_mncc_bearer_cap3DOT_0E._fields_ = [
('rate_adaption', gsm48_bcap_ra),
('sig_access', gsm48_bcap_sig_access),
('async', c_int),
('nr_stop_bits', c_int),
('nr_data_bits', c_int),
('user_rate', gsm48_bcap_user_rate),
('parity', gsm48_bcap_parity),
('interm_rate', gsm48_bcap_interm_rate),
('transp', gsm48_bcap_transp),
('modem_type', gsm48_bcap_modem_type),
]
gsm_mncc_bearer_cap._fields_ = [
('transfer', c_int),
('mode', c_int),
('coding', c_int),
('radio', c_int),
('speech_ctm', c_int),
('speech_ver', c_int * 8),
('data', N19gsm_mncc_bearer_cap3DOT_0E),
]
class gsm_mncc_number(Structure):
pass
gsm_mncc_number._fields_ = [
('type', c_int),
('plan', c_int),
('present', c_int),
('screen', c_int),
('number', c_char * 33),
]
class gsm_mncc_cause(Structure):
pass
gsm_mncc_cause._fields_ = [
('location', c_int),
('coding', c_int),
('rec', c_int),
('rec_val', c_int),
('value', c_int),
('diag_len', c_int),
('diag', c_char * 32),
]
class gsm_mncc_useruser(Structure):
pass
gsm_mncc_useruser._fields_ = [
('proto', c_int),
('info', c_char * 129),
]
class gsm_mncc_progress(Structure):
pass
gsm_mncc_progress._fields_ = [
('coding', c_int),
('location', c_int),
('descr', c_int),
]
class gsm_mncc_facility(Structure):
pass
gsm_mncc_facility._fields_ = [
('len', c_int),
('info', c_char * 128),
]
class gsm_mncc_ssversion(Structure):
pass
gsm_mncc_ssversion._fields_ = [
('len', c_int),
('info', c_char * 128),
]
class gsm_mncc_cccap(Structure):
pass
gsm_mncc_cccap._fields_ = [
('dtmf', c_int),
('pcp', c_int),
]
# values for unnamed enumeration
class gsm_mncc(Structure):
pass
uint32_t = c_uint32
class N8gsm_mncc3DOT_2E(Structure):
pass
N8gsm_mncc3DOT_2E._fields_ = [
('sup', c_int),
('inv', c_int),
]
gsm_mncc._fields_ = [
('msg_type', uint32_t),
('callref', uint32_t),
('fields', uint32_t),
('bearer_cap', gsm_mncc_bearer_cap),
('called', gsm_mncc_number),
('calling', gsm_mncc_number),
('redirecting', gsm_mncc_number),
('connected', gsm_mncc_number),
('cause', gsm_mncc_cause),
('progress', gsm_mncc_progress),
('useruser', gsm_mncc_useruser),
('facility', gsm_mncc_facility),
('cccap', gsm_mncc_cccap),
('ssversion', gsm_mncc_ssversion),
('clir', N8gsm_mncc3DOT_2E),
('signal', c_int),
('keypad', c_int),
('more', c_int),
('notify', c_int),
('emergency', c_int),
('imsi', c_char * 16),
('lchan_type', c_ubyte),
('lchan_mode', c_ubyte),
]
class gsm_data_frame(Structure):
pass
gsm_data_frame._fields_ = [
('msg_type', uint32_t),
('callref', uint32_t),
('data', c_ubyte * 0),
]
class gsm_mncc_hello(Structure):
pass
gsm_mncc_hello._fields_ = [
('msg_type', uint32_t),
('version', uint32_t),
('mncc_size', uint32_t),
('data_frame_size', uint32_t),
('called_offset', uint32_t),
('signal_offset', uint32_t),
('emergency_offset', uint32_t),
('lchan_type_offset', uint32_t),
]
class gsm_mncc_rtp(Structure):
pass
uint16_t = c_uint16
gsm_mncc_rtp._fields_ = [
('msg_type', uint32_t),
('callref', uint32_t),
('ip', uint32_t),
('port', uint16_t),
('payload_type', uint32_t),
('payload_msg_type', uint32_t),
]
INT_LEAST8_MAX = 127 # Variable c_int '127'
_ATFILE_SOURCE = 1 # Variable c_int '1'
MNCC_SETUP_CNF = 260 # Variable c_int '260'
GSM_TCHH_FRAME = 770 # Variable c_int '770'
UINT8_MAX = 255 # Variable c_int '255'
MNCC_F_CAUSE = 32 # Variable c_int '32'
INT_LEAST32_MIN = -2147483648 # Variable c_int '-0x00000000080000000'
__GNU_LIBRARY__ = 6 # Variable c_int '6'
MNCC_REL_CNF = 274 # Variable c_int '274'
__USE_XOPEN = 1 # Variable c_int '1'
__USE_LARGEFILE64 = 1 # Variable c_int '1'
MNCC_RTP_CREATE = 516 # Variable c_int '516'
__USE_XOPEN2KXSI = 1 # Variable c_int '1'
MNCC_STOP_DTMF_RSP = 281 # Variable c_int '281'
MNCC_PROGRESS_REQ = 265 # Variable c_int '265'
__USE_POSIX2 = 1 # Variable c_int '1'
GSM_TCH_FRAME_AMR = 771 # Variable c_int '771'
__USE_XOPEN2K8XSI = 1 # Variable c_int '1'
MNCC_FACILITY_IND = 276 # Variable c_int '276'
MNCC_LCHAN_MODIFY = 515 # Variable c_int '515'
GSM_MAX_FACILITY = 128 # Variable c_int '128'
UINTMAX_MAX = 18446744073709551615L # Variable c_ulong '-1ul'
INT_FAST16_MIN = -9223372036854775808 # Variable c_long '-0x08000000000000000l'
__USE_XOPEN_EXTENDED = 1 # Variable c_int '1'
UINT64_MAX = 18446744073709551615L # Variable c_ulong '-1ul'
__USE_ATFILE = 1 # Variable c_int '1'
MNCC_START_DTMF_REJ = 279 # Variable c_int '279'
INT_LEAST16_MAX = 32767 # Variable c_int '32767'
MNCC_SETUP_COMPL_IND = 262 # Variable c_int '262'
MNCC_SOCK_VERSION = 5 # Variable c_int '5'
INTMAX_MIN = -9223372036854775808 # Variable c_long '-0x08000000000000000l'
INT32_MAX = 2147483647 # Variable c_int '2147483647'
INTMAX_MAX = 9223372036854775807 # Variable c_long '9223372036854775807l'
MNCC_USERINFO_IND = 294 # Variable c_int '294'
_POSIX_SOURCE = 1 # Variable c_int '1'
_ISOC95_SOURCE = 1 # Variable c_int '1'
INT64_MIN = -9223372036854775808 # Variable c_long '-0x08000000000000000l'
MNCC_REL_REQ = 272 # Variable c_int '272'
_ISOC99_SOURCE = 1 # Variable c_int '1'
UINT_FAST8_MAX = 255 # Variable c_int '255'
MNCC_NOTIFY_IND = 269 # Variable c_int '269'
MNCC_HOLD_CNF = 288 # Variable c_int '288'
INT_LEAST8_MIN = -128 # Variable c_int '-0x00000000000000080'
MNCC_REL_IND = 273 # Variable c_int '273'
MNCC_F_SIGNAL = 8192 # Variable c_int '8192'
INT_FAST64_MIN = -9223372036854775808 # Variable c_long '-0x08000000000000000l'
INT_FAST64_MAX = 9223372036854775807 # Variable c_long '9223372036854775807l'
INT_LEAST64_MIN = -9223372036854775808 # Variable c_long '-0x08000000000000000l'
MNCC_BRIDGE = 512 # Variable c_int '512'
MNCC_F_CALLED = 2 # Variable c_int '2'
UINT_LEAST32_MAX = 4294967295L # Variable c_uint '4294967295u'
__USE_POSIX199309 = 1 # Variable c_int '1'
MNCC_RTP_CONNECT = 517 # Variable c_int '517'
__SYSCALL_WORDSIZE = 64 # Variable c_int '64'
_SVID_SOURCE = 1 # Variable c_int '1'
MNCC_SOCKET_HELLO = 1024 # Variable c_int '1024'
UINT32_MAX = 4294967295L # Variable c_uint '4294967295u'
MNCC_F_PROGRESS = 128 # Variable c_int '128'
MNCC_HOLD_REJ = 289 # Variable c_int '289'
GSM_MAX_USERUSER = 128 # Variable c_int '128'
INT64_MAX = 9223372036854775807 # Variable c_long '9223372036854775807l'
MNCC_SETUP_REQ = 257 # Variable c_int '257'
MNCC_F_USERUSER = 64 # Variable c_int '64'
MNCC_REJ_REQ = 295 # Variable c_int '295'
__USE_XOPEN2K = 1 # Variable c_int '1'
__WORDSIZE_TIME64_COMPAT32 = 1 # Variable c_int '1'
__USE_POSIX = 1 # Variable c_int '1'
__USE_XOPEN2K8 = 1 # Variable c_int '1'
MNCC_USERINFO_REQ = 293 # Variable c_int '293'
MNCC_RTP_FREE = 518 # Variable c_int '518'
__USE_GNU = 1 # Variable c_int '1'
__USE_BSD = 1 # Variable c_int '1'
MNCC_F_REDIRECTING = 8 # Variable c_int '8'
UINTPTR_MAX = 18446744073709551615L # Variable c_ulong '-1ul'
MNCC_ALERT_IND = 267 # Variable c_int '267'
MNCC_ALERT_REQ = 266 # Variable c_int '266'
MNCC_MODIFY_IND = 283 # Variable c_int '283'
MNCC_CALL_CONF_IND = 263 # Variable c_int '263'
_POSIX_C_SOURCE = 200809 # Variable c_long '200809l'
INT16_MIN = -32768 # Variable c_int '-0x00000000000008000'
_ISOC11_SOURCE = 1 # Variable c_int '1'
MNCC_RETRIEVE_REJ = 292 # Variable c_int '292'
INT8_MAX = 127 # Variable c_int '127'
INT16_MAX = 32767 # Variable c_int '32767'
INT_LEAST64_MAX = 9223372036854775807 # Variable c_long '9223372036854775807l'
__USE_SVID = 1 # Variable c_int '1'
__USE_UNIX98 = 1 # Variable c_int '1'
__USE_MISC = 1 # Variable c_int '1'
__GLIBC__ = 2 # Variable c_int '2'
MNCC_DISC_IND = 271 # Variable c_int '271'
_DEFAULT_SOURCE = 1 # Variable c_int '1'
MNCC_FACILITY_REQ = 275 # Variable c_int '275'
INT8_MIN = -128 # Variable c_int '-0x00000000000000080'
MNCC_RETRIEVE_IND = 290 # Variable c_int '290'
INTPTR_MIN = -9223372036854775808 # Variable c_long '-0x08000000000000000l'
UINT_LEAST64_MAX = 18446744073709551615L # Variable c_ulong '-1ul'
MNCC_F_CONNECTED = 16 # Variable c_int '16'
UINT_FAST64_MAX = 18446744073709551615L # Variable c_ulong '-1ul'
_STDINT_H = 1 # Variable c_int '1'
MNCC_STOP_DTMF_IND = 280 # Variable c_int '280'
__USE_FORTIFY_LEVEL = 2 # Variable c_int '2'
PTRDIFF_MAX = 9223372036854775807 # Variable c_long '9223372036854775807l'
MNCC_F_CCCAP = 2048 # Variable c_int '2048'
MNCC_MODIFY_CNF = 285 # Variable c_int '285'
INT32_MIN = -2147483648 # Variable c_int '-0x00000000080000000'
UINT16_MAX = 65535 # Variable c_int '65535'
MNCC_F_KEYPAD = 4096 # Variable c_int '4096'
INT_LEAST32_MAX = 2147483647 # Variable c_int '2147483647'
UINT_LEAST8_MAX = 255 # Variable c_int '255'
MNCC_HOLD_IND = 287 # Variable c_int '287'
__USE_LARGEFILE = 1 # Variable c_int '1'
__USE_EXTERN_INLINES = 1 # Variable c_int '1'
PTRDIFF_MIN = -9223372036854775808 # Variable c_long '-0x08000000000000000l'
UINT_FAST32_MAX = 18446744073709551615L # Variable c_ulong '-1ul'
_FEATURES_H = 1 # Variable c_int '1'
GSM_MAX_SSVERSION = 128 # Variable c_int '128'
MNCC_REJ_IND = 296 # Variable c_int '296'
MNCC_START_DTMF_RSP = 278 # Variable c_int '278'
SIG_ATOMIC_MIN = -2147483648 # Variable c_int '-0x00000000080000000'
__USE_POSIX199506 = 1 # Variable c_int '1'
MNCC_MODIFY_REQ = 282 # Variable c_int '282'
MNCC_F_FACILITY = 512 # Variable c_int '512'
SIG_ATOMIC_MAX = 2147483647 # Variable c_int '2147483647'
INT_FAST32_MIN = -9223372036854775808 # Variable c_long '-0x08000000000000000l'
MNCC_CALL_PROC_REQ = 264 # Variable c_int '264'
MNCC_SETUP_COMPL_REQ = 261 # Variable c_int '261'
MNCC_MODIFY_REJ = 286 # Variable c_int '286'
GSM_TCHF_FRAME = 768 # Variable c_int '768'
INT_FAST16_MAX = 9223372036854775807 # Variable c_long '9223372036854775807l'
MNCC_START_DTMF_IND = 277 # Variable c_int '277'
_XOPEN_SOURCE_EXTENDED = 1 # Variable c_int '1'
MNCC_SETUP_IND = 258 # Variable c_int '258'
MNCC_NOTIFY_REQ = 268 # Variable c_int '268'
UINT_FAST16_MAX = 18446744073709551615L # Variable c_ulong '-1ul'
INT_LEAST16_MIN = -32768 # Variable c_int '-0x00000000000008000'
__WORDSIZE = 64 # Variable c_int '64'
MNCC_FRAME_DROP = 514 # Variable c_int '514'
_SYS_CDEFS_H = 1 # Variable c_int '1'
INT_FAST8_MIN = -128 # Variable c_int '-0x00000000000000080'
MNCC_RETRIEVE_CNF = 291 # Variable c_int '291'
MNCC_F_EMERGENCY = 256 # Variable c_int '256'
_LARGEFILE64_SOURCE = 1 # Variable c_int '1'
MNCC_MODIFY_RSP = 284 # Variable c_int '284'
_XOPEN_SOURCE = 700 # Variable c_int '700'
MNCC_DISC_REQ = 270 # Variable c_int '270'
MNCC_SETUP_RSP = 259 # Variable c_int '259'
SIZE_MAX = 18446744073709551615L # Variable c_ulong '-1ul'
INT_FAST8_MAX = 127 # Variable c_int '127'
WINT_MIN = 0L # Variable c_uint '0u'
__USE_ISOC95 = 1 # Variable c_int '1'
MNCC_FRAME_RECV = 513 # Variable c_int '513'
UINT_LEAST16_MAX = 65535 # Variable c_int '65535'
INTPTR_MAX = 9223372036854775807 # Variable c_long '9223372036854775807l'
GSM_TCHF_FRAME_EFR = 769 # Variable c_int '769'
__USE_ISOC99 = 1 # Variable c_int '1'
_BITS_WCHAR_H = 1 # Variable c_int '1'
__GLIBC_MINOR__ = 19 # Variable c_int '19'
MNCC_F_CALLING = 4 # Variable c_int '4'
INT_FAST32_MAX = 9223372036854775807 # Variable c_long '9223372036854775807l'
MNCC_F_SSVERSION = 1024 # Variable c_int '1024'
MNCC_F_BEARER_CAP = 1 # Variable c_int '1'
__USE_ISOC11 = 1 # Variable c_int '1'
WINT_MAX = 4294967295L # Variable c_uint '4294967295u'
_BSD_SOURCE = 1 # Variable c_int '1'
_LARGEFILE_SOURCE = 1 # Variable c_int '1'
GSM_BAD_FRAME = 1023 # Variable c_int '1023'
int8_t = c_int8
int16_t = c_int16
int32_t = c_int32
int64_t = c_int64
uint8_t = c_uint8
uint64_t = c_uint64
int_least8_t = c_byte
int_least16_t = c_short
int_least32_t = c_int
int_least64_t = c_long
uint_least8_t = c_ubyte
uint_least16_t = c_ushort
uint_least32_t = c_uint
uint_least64_t = c_ulong
int_fast8_t = c_byte
int_fast16_t = c_long
int_fast32_t = c_long
int_fast64_t = c_long
uint_fast8_t = c_ubyte
uint_fast16_t = c_ulong
uint_fast32_t = c_ulong
uint_fast64_t = c_ulong
intptr_t = c_long
uintptr_t = c_ulong
intmax_t = c_long
uintmax_t = c_ulong
__all__ = ['GSM48_BCAP_SA_X28_DP_UN', 'gsm_mncc_number',
'GSM48_BCAP_UR_9600', '_POSIX_C_SOURCE', '_ATFILE_SOURCE',
'MNCC_SETUP_CNF', 'GSM48_BCAP_PAR_ONE', 'GSM_TCHH_FRAME',
'UINT8_MAX', '__USE_ATFILE', 'INT_LEAST8_MAX',
'MNCC_F_CAUSE', 'INT32_MIN', 'int_fast32_t',
'__GNU_LIBRARY__', 'MNCC_REL_CNF', 'WINT_MIN',
'__USE_XOPEN', '__USE_LARGEFILE64', 'MNCC_NOTIFY_REQ',
'MNCC_RTP_CREATE', 'MNCC_REJ_IND', '__USE_XOPEN2KXSI',
'MNCC_STOP_DTMF_RSP', 'UINT_FAST16_MAX',
'MNCC_PROGRESS_REQ', 'uint8_t', '__USE_POSIX2',
'GSM_TCH_FRAME_AMR', 'GSM48_BCAP_TR_RLP_PREF',
'INT_LEAST16_MIN', 'MNCC_SETUP_COMPL_IND',
'uint_least16_t', 'MNCC_FACILITY_IND', 'MNCC_LCHAN_MODIFY',
'GSM_MAX_FACILITY', 'UINTMAX_MAX', 'GSM48_BCAP_SA_X21',
'_LARGEFILE_SOURCE', 'INT_FAST16_MIN', 'MNCC_F_KEYPAD',
'GSM_MNCC_BCAP_UNR_DIG', 'UINT64_MAX',
'gsm_mncc_ssversion', 'GSM48_BCAP_TR_TR_PREF',
'MNCC_START_DTMF_REJ', 'GSM48_BCAP_MT_AUTO_1',
'INT_LEAST16_MAX', 'N19gsm_mncc_bearer_cap3DOT_0E',
'MNCC_SOCK_VERSION', 'INTMAX_MIN', 'INT_LEAST32_MAX',
'GSM48_BCAP_IR_16k', 'GSM48_BCAP_UR_12000',
'GSM48_BCAP_PAR_EVEN', 'int_least16_t', 'INTMAX_MAX',
'GSM48_BCAP_TR_RLP', 'MNCC_USERINFO_IND', '_POSIX_SOURCE',
'_ISOC95_SOURCE', 'uint_fast16_t', 'INT64_MIN',
'_ISOC99_SOURCE', 'uint_least8_t', 'UINT_FAST8_MAX',
'__USE_POSIX', '__USE_SVID', 'MNCC_HOLD_CNF',
'INT_LEAST8_MIN', 'MNCC_REL_IND', 'GSM48_BCAP_UR_1200',
'GSM48_BCAP_MT_V26ter', 'MNCC_F_SIGNAL',
'GSM48_BCAP_SA_X32', 'INT_FAST64_MIN', 'gsm_mncc_cause',
'MNCC_DISC_REQ', 'MNCC_BRIDGE', 'int16_t',
'GSM48_BCAP_UR_2400', 'uintmax_t', 'MNCC_F_CALLED',
'UINT_LEAST32_MAX', 'MNCC_REL_REQ', 'MNCC_RTP_CONNECT',
'GSM48_BCAP_TR_TRANSP', '__SYSCALL_WORDSIZE',
'__GLIBC_MINOR__', 'int_least8_t', 'MNCC_SOCKET_HELLO',
'UINT32_MAX', 'MNCC_F_PROGRESS', 'MNCC_HOLD_REJ',
'GSM48_BCAP_SA_I440_I450', 'int64_t', 'GSM_MAX_USERUSER',
'GSM48_BCAP_PAR_ODD', 'GSM48_BCAP_PAR_NONE', 'INT64_MAX',
'MNCC_F_FACILITY', 'MNCC_SETUP_REQ', 'GSM48_BCAP_RA_X31',
'gsm_mncc_bearer_cap', 'MNCC_F_USERUSER', '_SVID_SOURCE',
'__USE_XOPEN2K', '__WORDSIZE_TIME64_COMPAT32',
'gsm_data_frame', 'MNCC_HOLD_IND', 'GSM48_BCAP_UR_1200_75',
'GSM48_BCAP_MT_V22bis', 'GSM_MNCC_BCAP_SPEECH',
'MNCC_USERINFO_REQ', 'MNCC_RTP_FREE', '__USE_GNU',
'__USE_BSD', 'gsm_mncc_cccap', 'GSM48_BCAP_PAR_ZERO',
'MNCC_F_REDIRECTING', 'UINTPTR_MAX', 'GSM48_BCAP_RA_NONE',
'UINT_LEAST16_MAX', 'gsm48_bcap_user_rate', 'uint16_t',
'MNCC_MODIFY_IND', 'uint_fast8_t',
'gsm48_bcap_interm_rate', 'gsm_mncc', 'INT16_MIN',
'_ISOC11_SOURCE', 'MNCC_RETRIEVE_REJ', 'INT8_MAX',
'GSM48_BCAP_MT_UNDEF', 'int32_t', 'uint_least64_t',
'INT16_MAX', 'GSM48_BCAP_UR_4800', 'INT_LEAST64_MAX',
'GSM48_BCAP_SA_X28_DP_IN', 'GSM_MNCC_BCAP_FAX_G3',
'__USE_MISC', 'INTPTR_MAX', 'MNCC_DISC_IND',
'_DEFAULT_SOURCE', 'MNCC_FACILITY_REQ',
'gsm_mncc_useruser', 'INT8_MIN', 'MNCC_RETRIEVE_IND',
'GSM48_BCAP_RA_V110_X30', 'gsm_mncc_progress',
'gsm48_bcap_transp', 'INTPTR_MIN', '__USE_ISOC99',
'UINT_LEAST64_MAX', 'MNCC_F_CONNECTED',
'GSM_MNCC_BCAP_AUDIO', 'int_least64_t', 'UINT_FAST64_MAX',
'uintptr_t', 'INT_FAST64_MAX', '_STDINT_H',
'MNCC_STOP_DTMF_IND', '__USE_FORTIFY_LEVEL',
'gsm48_bcap_parity', 'int8_t', 'PTRDIFF_MAX',
'__USE_XOPEN2K8', 'gsm48_bcap_sig_access', 'MNCC_F_CCCAP',
'int_fast8_t', 'MNCC_MODIFY_CNF', 'gsm_mncc_rtp',
'INT_LEAST32_MIN', 'uint_least32_t', 'UINT16_MAX',
'GSM48_BCAP_MT_V32', '__USE_XOPEN_EXTENDED', 'INT32_MAX',
'__USE_UNIX98', 'UINT_LEAST8_MAX', 'uint_fast64_t',
'INT_LEAST64_MIN', '__USE_LARGEFILE',
'__USE_EXTERN_INLINES', 'PTRDIFF_MIN', 'UINT_FAST32_MAX',
'_FEATURES_H', 'GSM_MNCC_BCAP_OTHER_ITC', 'gsm_mncc_hello',
'uint64_t', 'GSM_MAX_SSVERSION', 'MNCC_ALERT_REQ',
'GSM48_BCAP_RA_OTHER', 'MNCC_START_DTMF_RSP',
'SIG_ATOMIC_MIN', '__USE_POSIX199506', 'MNCC_MODIFY_REQ',
'gsm_mncc_facility', 'GSM_MNCC_BCAP_RESERVED',
'SIG_ATOMIC_MAX', 'intptr_t', 'SIZE_MAX', 'uint_fast32_t',
'INT_FAST32_MIN', '__USE_ISOC11', 'gsm48_bcap_modem_type',
'int_fast16_t', 'GSM48_BCAP_UR_300',
'MNCC_SETUP_COMPL_REQ', 'MNCC_MODIFY_REJ',
'GSM_TCHF_FRAME', 'INT_FAST16_MAX', 'GSM48_BCAP_MT_V21',
'GSM48_BCAP_MT_V22', 'GSM48_BCAP_MT_V23',
'MNCC_START_DTMF_IND', '_XOPEN_SOURCE_EXTENDED',
'MNCC_SETUP_IND', '__USE_POSIX199309', 'MNCC_NOTIFY_IND',
'__USE_XOPEN2K8XSI', '__WORDSIZE', 'int_fast64_t',
'MNCC_FRAME_DROP', '_SYS_CDEFS_H', 'INT_FAST8_MIN',
'MNCC_RETRIEVE_CNF', 'MNCC_F_EMERGENCY',
'_LARGEFILE64_SOURCE', 'MNCC_MODIFY_RSP', '_XOPEN_SOURCE',
'MNCC_SETUP_RSP', 'MNCC_REJ_REQ', 'INT_FAST8_MAX',
'GSM48_BCAP_MT_NONE', '__USE_ISOC95', 'MNCC_FRAME_RECV',
'MNCC_ALERT_IND', 'intmax_t', '__GLIBC__',
'GSM_TCHF_FRAME_EFR', 'GSM48_BCAP_SA_X28_NDP',
'_BITS_WCHAR_H', 'N8gsm_mncc3DOT_2E', 'int_least32_t',
'GSM48_BCAP_IR_8k', 'MNCC_F_CALLING', 'INT_FAST32_MAX',
'MNCC_F_SSVERSION', 'MNCC_F_BEARER_CAP',
'MNCC_CALL_PROC_REQ', 'WINT_MAX', '_BSD_SOURCE',
'uint32_t', 'gsm48_bcap_ra', 'MNCC_CALL_CONF_IND',
'GSM_BAD_FRAME']

1042
mncc.xml Normal file

File diff suppressed because it is too large Load Diff

42
mncc_sock.py Normal file
View File

@ -0,0 +1,42 @@
#!/usr/bin/python
import socket
import sys
import os
import mncc
import ctypes
class mncc_msg(mncc.gsm_mncc):
def send(self):
return buffer(self)[:]
def receive(self, bytes):
fit = min(len(bytes), ctypes.sizeof(self))
ctypes.memmove(ctypes.addressof(self), bytes, fit)
def mncc_number(number, num_type = 0, num_plan = 0, num_present = 1, num_screen = 0):
return mncc.gsm_mncc_number(number = number, type = num_type,
plan = num_plan, present = num_present,
screen = num_screen)
class MnccSocket(object):
def __init__(self, address = '/tmp/bsc_mncc'):
self.sock = socket.socket(socket.AF_UNIX, socket.SOCK_SEQPACKET)
print 'connectiong to %s' % address
try:
self.sock.connect(address)
except socket.error, errmsg:
print >>sys.stderr, errmsg
sys.exit(1)
# FIXME: parse the HELLO message
msg = self.recv()
def send(self, msg):
return self.sock.sendall(msg.send())
def recv(self):
data = self.sock.recv(1500)
print 'received "%s"' % data
ms = mncc_msg()
ms.receive(data)
return ms

15
mncc_test2.py Executable file
View File

@ -0,0 +1,15 @@
#!/usr/bin/python
from gsm_call_fsm import GsmCallFsm
from mncc_sock import MnccSocket
mncc_sock = MnccSocket()
call = GsmCallFsm('foo', mncc_sock)
#call.fsm.mncc_setup_req()
call.start_mt_call("1234", "6789")
while 1:
msg = mncc_sock.recv()
# FIXME: look-up the call based on msg.callref
call.handle_mncc(msg)

63
mncc_twisted.py Executable file
View File

@ -0,0 +1,63 @@
#!/usr/bin/python
import os, sys
from twisted.python.log import startLogging
from twisted.python.filepath import FilePath
from twisted.internet.defer import Deferred
from twisted.internet.protocol import Factory, BaseProtocol
from twisted.internet.endpoints import UNIXClientEndpoint
from twisted.internet import reactor
import mncc
import ctypes
class mncc_msg(mncc.gsm_mncc):
def send(self):
return buffer(self)[:]
def receive(self, bytes):
fit = min(len(bytes), ctypes.sizeof(self))
ctypes.memmove(ctypes.addressof(self), bytes, fit)
def mncc_number(number, num_type = 0, num_plan = 0, num_present = 1, num_screen = 0):
return mncc.gsm_mncc_number(number = number, type = num_type,
plan = num_plan, present = num_present,
screen = num_screen)
class MnccProtocol(BaseProtocol):
def __init__(self):
self.whenDisconnected = Deferred()
def dataReceived(self, data):
print 'received "%s"' % data
ms = mncc_msg()
ms.receive(data)
def connectionLost(self, reason):
self.whenDisconnected.callback(None)
def main():
address = FilePath('/tmp/bsc_mncc')
startLogging(sys.stdout)
factory = Factory()
factory.protocol = MnccProtocol
factory.quiet = True
endpoint = UnixClientEndpoint(reactor, address.path)
connected = endpoint.connect(factory)
def succeded(client):
print "succeeded"
return client.whenDisconnected
def failed(reason):
print "Could not connect:", reason.getErrorMessage()
def disconnected(ignored):
print "disconnected"
reactor.stop()
connected.addCallbacks(succeeded, failed)
connected.addCallback(disconnected)
reactor.run()

13
pykka_test.py Executable file
View File

@ -0,0 +1,13 @@
#!/usr/bin/python
import pykka
class Greeter(pykka.ThreadingActor):
def on_receive(self, message):
print('Hi there, you sent %s' % message)
actor_ref = Greeter.start()
actor_ref.tell({'msg': 'Hi!'})
actor_ref.stop()

5
regen.sh Executable file
View File

@ -0,0 +1,5 @@
#/bin/sh
echo on Debian, codegen/cparser.py must call gccxml.real instead of gccxml!
cp ./mncc.h /tmp/mncc.h
h2xml.py ./mncc.h -c -o mncc.xml
xml2py.py mncc.xml -k dest -v -o mncc.py