Commit 6e6d7ca1 authored by Andreas Schmidt's avatar Andreas Schmidt
Browse files

Simplify and adapt Python bindings.

parent f1dfad6b
Pipeline #99 passed with stage
from libc.stdint cimport uint32_t, uint16_t, uint8_t, int32_t from libc.stdint cimport uint32_t, uint16_t, uint8_t, int32_t
cimport cprrt cimport cprrt
cdef extern from "prrt/applicationConstraints.c":
pass
cdef extern from "prrt/stores/forwardPacketTable.c": cdef extern from "prrt/stores/forwardPacketTable.c":
int PrrtForwardPacketTable_create(cprrt.PrrtForwardPacketTable* fpt_prt); pass
int PrrtForwardPacketTable_test_set_is_number_relevant(cprrt.PrrtForwardPacketTable *fpt_ptr, uint16_t sequenceNumber);
int PrrtForwardPacketTable_test_is_block_relevant(cprrt.PrrtForwardPacketTable * forwardPacketTable, uint16_t start, uint16_t length);
int PrrtForwardPacketTable_destroy(cprrt.PrrtForwardPacketTable* fpt_prt);
cdef extern from "prrt/processes/feedbackReceiver.c": cdef extern from "prrt/processes/feedbackReceiver.c":
void receive_feedback_loop(void *ptr) pass
cdef extern from "prrt/processes/dataReceiver.c": cdef extern from "prrt/processes/dataReceiver.c":
void receive_data_loop(void *ptr) pass
cdef extern from "prrt/processes/dataTransmitter.c": cdef extern from "prrt/processes/dataTransmitter.c":
void send_data_loop(void *ptr) pass
cdef extern from "prrt/block.c": cdef extern from "prrt/block.c":
cprrt.PrrtPacket *PrrtBlock_get_first_data(cprrt.PrrtBlock *block_ptr) pass
cdef extern from "prrt/clock.c": cdef extern from "prrt/clock.c":
uint32_t PrrtClock_get_current_time(); pass
cdef extern from "prrt/channelStateInformation.c": cdef extern from "prrt/channelStateInformation.c":
void PrrtChannelStateInformation_init(cprrt.PrrtChannelStateInformation *csi) pass
cdef extern from "prrt/vdmcode/block_code.c": cdef extern from "prrt/vdmcode/block_code.c":
int PrrtCoder_get_coder(cprrt.PrrtCoder **cod, uint8_t n, uint8_t k) pass
cdef extern from "prrt/codingParams.c": cdef extern from "prrt/codingParams.c":
void PrrtCodingParams_init(cprrt.PrrtCodingParams *cpar) pass
cdef extern from "prrt/receiver.c": cdef extern from "prrt/receiver.c":
cprrt.PrrtReceiver* PrrtReceiver_create(const char *host, uint16_t port) pass
bint PrrtReceiver_destroy(cprrt.PrrtReceiver* receiver)
cdef extern from "prrt/packet.c": cdef extern from "prrt/packet.c":
uint8_t PrrtPacket_type(cprrt.PrrtPacket *packet_ptr) pass
uint8_t PrrtPacket_priority(cprrt.PrrtPacket *packet_ptr)
uint16_t PrrtPacket_size(cprrt.PrrtPacket *packet_ptr)
int PrrtPacket_print(cprrt.PrrtPacket *packet_ptr)
cdef extern from "prrt/socket.c": cdef extern from "prrt/socket.c":
cprrt.PrrtSocket* PrrtSocket_create(uint16_t port, uint8_t isSender) pass
cdef extern from "util/bptree.c": cdef extern from "util/bptree.c":
cprrt.BPTreeNode *BPTree_insert(cprrt.BPTreeNode *root, int key, void *value) pass
cprrt.BPTreeNode *BPTree_delete(cprrt.BPTreeNode *root, int key)
cprrt.BPTreeNode *BPTree_destroy(cprrt.BPTreeNode *root)
void *BPTree_get(cprrt.BPTreeNode *root, int key)
void BPTree_get_range(cprrt.BPTreeNode *root, cprrt.List *list, int key_start, int key_end)
cdef extern from "util/list.c":
void List_push(cprrt.List *list, const void *value)
void *List_pop(const cprrt.List *list)
void List_unshift(cprrt.List *list, const void *value) cdef extern from "util/bitmap.c":
void *List_shift(const cprrt.List *list) pass
void *List_remove(cprrt.List *list, const cprrt.ListNode *node) cdef extern from "util/list.c":
pass
cdef class PrrtSocket: cdef class PrrtSocket:
cdef cprrt.PrrtSocket* _c_socket cdef cprrt.PrrtSocket* _c_socket
......
...@@ -6,7 +6,7 @@ add_library(PRRT ../defines.h ...@@ -6,7 +6,7 @@ add_library(PRRT ../defines.h
packet.c packet.h packet.c packet.h
receiver.c receiver.h receiver.c receiver.h
socket.c socket.h socket.c socket.h
applicationContraints.c applicationContraints.h applicationConstraints.c applicationConstraints.h
vdmcode/block_code.c vdmcode/block_code.h vdmcode/block_code.c vdmcode/block_code.h
stores/forwardPacketTable.c stores/forwardPacketTable.h stores/forwardPacketTable.c stores/forwardPacketTable.h
stores/lossGatherer.c stores/lossGatherer.h stores/lossGatherer.c stores/lossGatherer.h
......
#include <malloc.h> #include <malloc.h>
#include "../util/common.h" #include "../util/common.h"
#include "../util/dbg.h" #include "../util/dbg.h"
#include "applicationContraints.h" #include "applicationConstraints.h"
PrrtApplicationConstraints *PrrtApplicationConstraints_create() PrrtApplicationConstraints *PrrtApplicationConstraints_create()
{ {
......
...@@ -313,7 +313,7 @@ PrrtPacket *PrrtSocket_recv_feedback(PrrtSocket *prrtSocket, const size_t length ...@@ -313,7 +313,7 @@ PrrtPacket *PrrtSocket_recv_feedback(PrrtSocket *prrtSocket, const size_t length
PrrtPacketFeedbackPayload* payload = prrtPacket->payload; PrrtPacketFeedbackPayload* payload = prrtPacket->payload;
struct in_addr a; struct in_addr a;
a.s_addr = payload->receiverAddress; a.s_addr = payload->receiverAddress;
printf("%s\n", inet_ntoa(a)); debug("Receiver Address: %s", inet_ntoa(a));
prrtTimestamp_t forwardTripTimestamp = ((PrrtPacketFeedbackPayload*) prrtPacket->payload)->forwardTripTimestamp_us; prrtTimestamp_t forwardTripTimestamp = ((PrrtPacketFeedbackPayload*) prrtPacket->payload)->forwardTripTimestamp_us;
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
#include "../util/list.h" #include "../util/list.h"
#include "../util/bptree.h" #include "../util/bptree.h"
#include "channelStateInformation.h" #include "channelStateInformation.h"
#include "applicationContraints.h" #include "applicationConstraints.h"
#include "clock.h" #include "clock.h"
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment