aboutsummaryrefslogtreecommitdiffstats
path: root/src/amps/transaction.h
diff options
context:
space:
mode:
authorAndreas Eversberg <jolly@eversberg.eu>2016-05-01 19:51:56 +0200
committerAndreas Eversberg <jolly@eversberg.eu>2016-06-17 17:03:29 +0200
commitd2c4ca4fa91d9496f5b7a5f2dc1c6b66bb52ced8 (patch)
treedd9c2d4cbe270a3fdcbacb08f566578d3386211f /src/amps/transaction.h
parent7d5d3da8d35ee5e34eb9b3b4fbd821b9f4b28fb5 (diff)
Implementation of Advanced Mobile Phone Service (AMPS)
Diffstat (limited to 'src/amps/transaction.h')
-rw-r--r--src/amps/transaction.h48
1 files changed, 48 insertions, 0 deletions
diff --git a/src/amps/transaction.h b/src/amps/transaction.h
new file mode 100644
index 0000000..760207e
--- /dev/null
+++ b/src/amps/transaction.h
@@ -0,0 +1,48 @@
+
+typedef struct amps amps_t;
+
+enum amps_trans_state {
+ TRANS_NULL = 0,
+ TRANS_REGISTER_ACK, /* attach request received, waiting to ack */
+ TRANS_REGISTER_ACK_SEND, /* attach request received, sending ack */
+ TRANS_CALL_MO_ASSIGN, /* assigning channel, waiting to send */
+ TRANS_CALL_MO_ASSIGN_SEND, /* assigning channel, sending assignment */
+ TRANS_CALL_MT_ASSIGN, /* assigning channel, waiting to send */
+ TRANS_CALL_MT_ASSIGN_SEND, /* assigning channel, sending assignment */
+ TRANS_CALL_MT_ALERT, /* ringing the phone, sending alert order until signalling tone is received */
+ TRANS_CALL_MT_ALERT_SEND, /* ringing the phone, signalling tone is received */
+ TRANS_CALL_REJECT, /* rejecting channel, waiting to send */
+ TRANS_CALL_REJECT_SEND, /* rejecting channel, sending reject */
+ TRANS_CALL, /* active call */
+ TRANS_CALL_RELEASE, /* release call towards phone, waiting to send */
+ TRANS_CALL_RELEASE_SEND, /* release call towards phone, sending release */
+ TRANS_PAGE, /* paging phone, waiting to send */
+ TRANS_PAGE_SEND, /* paging phone, sending page order */
+ TRANS_PAGE_REPLY, /* waitring for paging reply */
+};
+
+typedef struct transaction {
+ struct transaction *next; /* pointer to next node in list */
+ amps_t *amps; /* pointer to amps instance */
+ uint32_t min1; /* current station ID (2 values) */
+ uint16_t min2;
+ uint8_t msg_type; /* message type (3 values) */
+ uint8_t ordq;
+ uint8_t order;
+ uint16_t chan; /* channel to assign */
+ char dialing[33]; /* number dialed by the phone */
+ enum amps_trans_state state; /* state of transaction */
+ struct timer timer; /* for varous timeouts */
+ int sat_detected; /* state if we detected SAT */
+} transaction_t;
+
+transaction_t *create_transaction(amps_t *amps, enum amps_trans_state trans_state, uint32_t min1, uint16_t min2, uint8_t msg_type, uint8_t ordq, uint8_t order, uint16_t chan);
+void destroy_transaction(transaction_t *trans);
+void link_transaction(transaction_t *trans, amps_t *amps);
+void unlink_transaction(transaction_t *trans);
+transaction_t *search_transaction(amps_t *amps, uint32_t state_mask);
+transaction_t *search_transaction_number(amps_t *amps, uint32_t min1, uint16_t min2);
+void trans_new_state(transaction_t *trans, int state);
+void amps_flush_other_transactions(amps_t *amps, transaction_t *trans);
+void transaction_timeout(struct timer *timer);
+