Skip to content

Commit

Permalink
refactor scheduling capabilities
Browse files Browse the repository at this point in the history
  • Loading branch information
lucabaldesi committed May 28, 2018
1 parent 0d84cf6 commit 10c40de
Show file tree
Hide file tree
Showing 23 changed files with 863 additions and 1,415 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
GRAPES ?= $(PWD)/../grapes
GRAPES ?= $(PWD)/../GRAPES
NET_HELPER ?= $(PWD)/Lib/net_helper
LIBNETHELPER=$(NET_HELPER)/libnethelper.a
LIBGRAPES=$(GRAPES)/src/libgrapes.a
Expand Down
4 changes: 3 additions & 1 deletion pstreamer.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ void show_help()
fprintf(stdout, "\tsource_multipolicity=<int>:\tnumber of chunks the source pushes in seeding (default=3)\n");
fprintf(stdout, "\tfilename=<string>:\t\tfilename of a media content to be streamed (source side only)\n");
fprintf(stdout, "\tAF=INET|INET6:\t\t\taddress family, IPv4 or IPv6 (default=INET)\n");
fprintf(stdout, "\toffer_per_period=<int>:\t\tamount of offer to perform per offer period (default=1)\n");
fprintf(stdout, "\toffer_per_period=<int>:\t\tnumber of offers per approximated chunk interval (default=1)\n");
fprintf(stdout, "\tpeers_per_offer=<int>:\t\tnumber of peers to offer chunks to (default=1)\n");
fprintf(stdout, "\tchunks_per_peer_offer=<int>:\t\tmax number of chunks to be sent to a peer (default=1)\n");
fprintf(stdout, "\tneighbourhood_size=<int>:\ttarget neighbourhood size (default=30)\n");
fprintf(stdout, "\tpeer_timeout=<int>:\t\ttimeout in seconds after which a peer is considered dead (default=10)\n");
fprintf(stdout, "\tdist_type=random|turbo:\t\tP2P distribution policy (default=random)\n");
Expand Down
58 changes: 58 additions & 0 deletions src/chunk_attributes.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#include<stdint.h>
#include<chunk_attributes.h>
#include<stdlib.h>

struct chunk_attributes {
uint16_t hopcount;
} __attribute__((packed));

int8_t chunk_attributes_init(struct chunk *c)
{
int8_t res = -1;
struct chunk_attributes * attr;

if (c)
{
c->attributes_size = sizeof(struct chunk_attributes);
c->attributes = attr = malloc(c->attributes_size);
attr->hopcount = 0;
}
return res;
}

uint16_t chunk_attributes_get_hopcount(const struct chunk * c)
{
struct chunk_attributes * attr;

attr = c->attributes;
return attr->hopcount;
}

int8_t chunk_attributes_deinit(struct chunk * c)
{
if (c && c->attributes)
{
free(c->attributes);
c->attributes_size = 0;
return 0;
}
return -1;
}

int8_t chunk_attributes_update_upon_reception(struct chunk *c)
{
struct chunk_attributes * attr;

if (c && c->attributes)
{
attr = c->attributes;
attr->hopcount++;
}
return -1;
}

int8_t chunk_attributes_update_upon_sending(struct chunk *c)
{
return 0;
}

21 changes: 21 additions & 0 deletions src/chunk_attributes.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#ifndef __CHUNK_ATTRIBUTES_H__
#define __CHUNK_ATTRIBUTES_H__

#include<stdint.h>

#include<chunk.h>


struct chunk_attributes;

int8_t chunk_attributes_init(struct chunk *c);

int8_t chunk_attributes_deinit(struct chunk * c);

uint16_t chunk_attributes_get_hopcount(const struct chunk * c);

int8_t chunk_attributes_update_upon_sending(struct chunk *c);

int8_t chunk_attributes_update_upon_reception(struct chunk *c);

#endif
169 changes: 0 additions & 169 deletions src/chunk_signaling.c

This file was deleted.

28 changes: 0 additions & 28 deletions src/chunk_signaling.h

This file was deleted.

Loading

0 comments on commit 10c40de

Please sign in to comment.