Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 19 additions & 18 deletions include/stun_intern.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,22 +59,24 @@ typedef struct {
struct sockaddr_storage serverAddr;
struct sockaddr_storage baseAddr;
bool useRelay;
char ufrag[300]; /* TBD = ICE_MAX_UFRAG_LENGTH*/
char password[300]; /* TBD = ICE_MAX_PASSWD_LENGTH*/
uint32_t peerPriority;
bool useCandidate;
bool iceControlling;
uint64_t tieBreaker;
uint32_t proto;
uint8_t ttl;
StunMsgId transactionId;
uint32_t sockhandle;
STUN_SENDFUNC sendFunc;
STUNCB stunCbFunc;
DiscussData* discussData; /*NULL allowed if none present */
bool addSoftware;
bool stuntrace;
bool addTransCnt;
/* char ufrag[300]; / * TBD =
* ICE_MAX_UFRAG_LENGTH* / */
/* char password[300]; / * TBD = ICE_MAX_PASSWD_LENGTH* / */
/* uint32_t peerPriority; */
/* bool useCandidate; */
/* bool iceControlling; */
/* uint64_t tieBreaker; */
uint32_t proto;
uint8_t ttl;
/* StunMsgId transactionId; */
/* uint32_t sockhandle; */
TransactionAttributes transAttr;
STUN_SENDFUNC sendFunc;
STUNCB stunCbFunc;

bool addSoftware;
bool stuntrace;
bool addTransCnt;
} StunBindReqStruct;

struct StunClientStats
Expand Down Expand Up @@ -127,8 +129,7 @@ typedef struct
/* uint32_t ttl; */

/* DISCUSS */
bool hasDiscuss;
DiscussData discussData;
bool hasDiscuss;

struct StunClientStats stats;
STUN_CLIENT_DATA* client;
Expand Down
22 changes: 6 additions & 16 deletions include/stunclient.h
Original file line number Diff line number Diff line change
Expand Up @@ -171,31 +171,21 @@ StunClient_startBindTransaction(STUN_CLIENT_DATA* clientData,
const struct sockaddr* baseAddr,
int proto,
bool useRelay,
const char* ufrag,
const char* password,
uint32_t peerPriority,
bool useCandidate,
bool iceControlling,
uint64_t tieBreaker,
StunMsgId transactionId,
uint32_t sockhandle,
TransactionAttributes* transAttr,
STUN_SENDFUNC sendFunc,
STUNCB stunCbFunc,
DiscussData* discussData);
STUNCB stunCbFunc);

void
StunClient_startSTUNTrace(STUN_CLIENT_DATA* clientData,
void* userCtx,
const struct sockaddr* serverAddr,
const struct sockaddr* baseAddr,
bool useRelay,
const char* ufrag,
const char* password,
uint8_t ttl,
StunMsgId transactionId,
uint32_t sockhandle,
TransactionAttributes* transAttr,
STUN_SENDFUNC sendFunc,
STUNCB stunCbFunc,
DiscussData* discussData);
STUNCB stunCbFunc);

/*
* This function must be called by the application every N msec. N must be same
* as in StunClientBind_Init(instances, N)
Expand Down
97 changes: 37 additions & 60 deletions include/stunlib.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,16 +84,9 @@ extern "C" {
/*Path Discovery test attribute */
#define STUN_ATTR_PD 0x8041

/*DISCUSS Draft Attributes */
#define STUN_ATTR_StreamType 0x8050
#define STUN_ATTR_NetworkStatus 0x8051
#define STUN_ATTR_BandwidthUsage 0x8052

/* STUN CISCO Extensions */
#define STUN_ATTR_Cisco_Network_Feedback 0xC001

/* STUN CISCO Extensions */
#define STUN_ATTR_Cisco_Network_Feedback 0xC001
/*ENF Draft Attributes */
#define STUN_ATTR_EnfFlowDescription 0xC001
#define STUN_ATTR_EnfNetworkStatus 0xC002

/*STUNTrace Attributes (Experimental) */
#define STUN_ATTR_TTL 0x8055
Expand Down Expand Up @@ -192,6 +185,8 @@ extern "C" {
*
*
*
*
*
*msec
**/
#define STUNCLIENT_DFLT_TICK_TIMER_MS 50
Expand Down Expand Up @@ -350,11 +345,14 @@ StunAtrEvenPort;

typedef struct
{
uint16_t type;
uint8_t interactivity;
/*4 bits*/
uint8_t type;
/*4 bits*/
uint8_t tbd;
uint16_t bandwidthMax;
uint8_t pad;
}
StunAtrStreamType;
StunAtrEnfFlowDescription;

typedef struct
{
Expand All @@ -364,7 +362,7 @@ typedef struct
uint16_t upMaxBandwidth;
uint16_t downMaxBandwidth;
}
StunAtrNetworkStatus;
StunAtrEnfNetworkStatus;

typedef struct
{
Expand All @@ -374,14 +372,6 @@ typedef struct
}
StunAtrTransCount;

typedef struct
{
uint32_t first;
uint32_t second;
uint32_t third;
}
StunAtrCiscoNetworkFeedback;

typedef struct
{
uint16_t average;
Expand Down Expand Up @@ -410,31 +400,27 @@ typedef struct




typedef struct
{
uint16_t streamType;
uint8_t interactivity;

uint16_t bandwidthUsage_average;
uint16_t bandwidthUsage_max;

uint8_t networkStatus_flags;
uint8_t networkStatus_nodeCnt;
uint16_t networkStatus_tbd;
uint16_t networkStatus_upMaxBandwidth;
uint16_t networkStatus_downMaxBandwidth;

/*Ugh, maybee own structs? Will be Integrity protected*/
uint8_t networkStatusResp_flags;
uint8_t networkStatusResp_nodeCnt;
uint16_t networkStatusResp_tbd;
uint16_t networkStatusResp_upMaxBandwidth;
uint16_t networkStatusResp_downMaxBandwidth;



} DiscussData;
/* Core Values*/
StunMsgId transactionId;
uint32_t sockhandle;
/* ICE Related */
char username[STUN_MSG_MAX_USERNAME_LENGTH];
char password[STUN_MSG_MAX_PASSWORD_LENGTH];
uint32_t peerPriority;
bool useCandidate;
bool iceControlling;
uint64_t tieBreaker;
/* ENF */
bool addEnf;
StunAtrEnfFlowDescription enfFlowDescription;
StunAtrEnfNetworkStatus enfNetworkStatus;
StunAtrEnfNetworkStatus enfNetworkStatusResp;

/* MISC */

} TransactionAttributes;


/* Decoded STUN message */
Expand Down Expand Up @@ -531,28 +517,19 @@ typedef struct
bool hasReservationToken;
StunAtrDoubleValue reservationToken;

bool hasStreamType;
StunAtrStreamType streamType;

bool hasBandwidthUsage;
StunAtrBandwidthUsage bandwidthUsage;
bool hasEnfFlowDescription;
StunAtrEnfFlowDescription enfFlowDescription;

bool hasTTL;
StunAtrTTL ttl;

/*After Integrity attr*/
bool hasNetworkStatus;
StunAtrNetworkStatus networkStatus;

bool hasCiscoNetFeed;
StunAtrCiscoNetworkFeedback ciscoNetFeed;
bool hasEnfNetworkStatus;
StunAtrEnfNetworkStatus enfNetworkStatus;

/*Integrity protected*/
bool hasNetworkStatusResp;
StunAtrNetworkStatus networkStatusResp;

bool hasCiscoNetFeedResp;
StunAtrCiscoNetworkFeedback ciscoNetFeedResp;
bool hasEnfNetworkStatusResp;
StunAtrEnfNetworkStatus enfNetworkStatusResp;

bool hasTransCount;
StunAtrTransCount transCount;
Expand Down
28 changes: 18 additions & 10 deletions include/stunserver.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,19 @@ extern "C" {
#endif

bool
CreateConnectivityBindingResp(StunMessage * stunMsg,
StunMsgId transactionId,
const struct sockaddr* mappedSockAddr,
uint8_t reqTrnspCnt,
uint8_t respTrnspCnt,
uint16_t response,
uint32_t responseCode,
DiscussData * discussData);
CreateConnectivityBindingResp(StunMessage* stunMsg,
StunMsgId transactionId,
const struct sockaddr* mappedSockAddr,
uint8_t reqTrnspCnt,
uint8_t respTrnspCnt,
uint8_t enf_flags,
uint8_t enf_nodeCnt,
uint16_t enf_upMaxBandwidth,
uint16_t enf_downMaxBandwidth,
uint16_t response,
uint32_t responseCode);


/********* Server handling: send STUN BIND RESP *************/
bool
StunServer_SendConnectivityBindingResp(STUN_CLIENT_DATA * clientData,
Expand All @@ -35,12 +40,15 @@ extern "C" {
const struct sockaddr* dstAddr,
uint8_t reqTrnspCnt,
uint8_t respTrnspCnt,
uint8_t enf_flags,
uint8_t enf_nodeCnt,
uint16_t enf_upMaxBandwidth,
uint16_t enf_downMaxBandwidth,
void* userData,
STUN_SENDFUNC sendFunc,
int proto,
bool useRelay,
uint32_t responseCode,
DiscussData * discussData);
uint32_t responseCode);

/********** Server handling: incoming STUN BIND REQ **********/
bool
Expand Down
23 changes: 12 additions & 11 deletions include/stuntrace.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,21 +40,22 @@ struct hiutPathElement {

struct hiutResult {
/* STUN Setup */
void* stunCtx;
void* userCtx;
int32_t sockfd;
char username[STUN_MSG_MAX_USERNAME_LENGTH];
char password[STUN_MSG_MAX_PASSWORD_LENGTH];
void* stunCtx;
void* userCtx;
TransactionAttributes transAttr;
/* int32_t sockfd; */
/* char username[STUN_MSG_MAX_USERNAME_LENGTH]; */
/* char password[STUN_MSG_MAX_PASSWORD_LENGTH]; */

STUN_SENDFUNC sendFunc;


int32_t currentTTL;
StunMsgId currStunMsgId;
int32_t user_start_ttl;
int32_t user_max_ttl;
int32_t user_paralell_traces;
int32_t path_max_ttl; /*got port unreachable or STUN response
int32_t currentTTL;
/* StunMsgId currStunMsgId; */
int32_t user_start_ttl;
int32_t user_max_ttl;
int32_t user_paralell_traces;
int32_t path_max_ttl; /*got port unreachable or STUN response
**/
uint32_t wait_ms;
struct sockaddr_storage localAddr;
Expand Down
2 changes: 1 addition & 1 deletion include/turn_intern.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ struct TURN_INSTANCE_DATA
TurnAllocateReqStuct turnAllocateReq;
StunMsgId StunReqTransId; /* transaction
* id of
*request
* request
**/
StunMsgId PrevRespTransId; /* transaction
* id of last
Expand Down
4 changes: 2 additions & 2 deletions include/turnclient.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ TurnStats_T;

/* Defines how a user of turn sends data on e.g. socket */
typedef void (* TURN_SEND_FUNC)(const uint8_t* buffer, /* ptr to
* buffer to
* send */
* buffer to
* send */
size_t bufLen, /* length of
* send
* buffer */
Expand Down
Loading