diff options
author | Bart Polot <bart@net.in.tum.de> | 2012-06-14 16:50:52 +0000 |
---|---|---|
committer | Bart Polot <bart@net.in.tum.de> | 2012-06-14 16:50:52 +0000 |
commit | 78471039156f66f6b2a9f09e44e691c1207d2636 (patch) | |
tree | 347633725629ec3de1956c130e7bd1b2a01eb400 /src | |
parent | 1a23d2f11734b95c658049c1b529e1d90769b4f5 (diff) | |
download | gnunet-78471039156f66f6b2a9f09e44e691c1207d2636.tar.gz gnunet-78471039156f66f6b2a9f09e44e691c1207d2636.zip |
- add api side implementation of blacklisting
Diffstat (limited to 'src')
-rw-r--r-- | src/mesh/mesh_api.c | 45 |
1 files changed, 42 insertions, 3 deletions
diff --git a/src/mesh/mesh_api.c b/src/mesh/mesh_api.c index a2b1d67da..086b5fa71 100644 --- a/src/mesh/mesh_api.c +++ b/src/mesh/mesh_api.c | |||
@@ -1382,6 +1382,20 @@ GNUNET_MESH_disconnect (struct GNUNET_MESH_Handle *handle) | |||
1382 | 1382 | ||
1383 | 1383 | ||
1384 | /** | 1384 | /** |
1385 | * Announce to ther peer the availability of services described by the regex, | ||
1386 | * in order to be reachable to other peers via connect_by_string. | ||
1387 | * | ||
1388 | * @param h handle to mesh. | ||
1389 | * @param regex string with the regular expression describing local services. | ||
1390 | */ | ||
1391 | void | ||
1392 | GNUNET_MESH_announce_regex (struct GNUNET_MESH_Handle *h, | ||
1393 | const char *regex) | ||
1394 | { | ||
1395 | |||
1396 | } | ||
1397 | |||
1398 | /** | ||
1385 | * Create a new tunnel (we're initiator and will be allowed to add/remove peers | 1399 | * Create a new tunnel (we're initiator and will be allowed to add/remove peers |
1386 | * and to broadcast). | 1400 | * and to broadcast). |
1387 | * | 1401 | * |
@@ -1575,7 +1589,10 @@ GNUNET_MESH_peer_request_connect_by_type (struct GNUNET_MESH_Tunnel *tunnel, | |||
1575 | */ | 1589 | */ |
1576 | void | 1590 | void |
1577 | GNUNET_MESH_peer_request_connect_by_string (struct GNUNET_MESH_Tunnel *tunnel, | 1591 | GNUNET_MESH_peer_request_connect_by_string (struct GNUNET_MESH_Tunnel *tunnel, |
1578 | const char *description); | 1592 | const char *description) |
1593 | { | ||
1594 | |||
1595 | } | ||
1579 | 1596 | ||
1580 | 1597 | ||
1581 | /** | 1598 | /** |
@@ -1588,7 +1605,18 @@ GNUNET_MESH_peer_request_connect_by_string (struct GNUNET_MESH_Tunnel *tunnel, | |||
1588 | */ | 1605 | */ |
1589 | void | 1606 | void |
1590 | GNUNET_MESH_peer_blacklist (struct GNUNET_MESH_Tunnel *tunnel, | 1607 | GNUNET_MESH_peer_blacklist (struct GNUNET_MESH_Tunnel *tunnel, |
1591 | const struct GNUNET_PeerIdentity *peer); | 1608 | const struct GNUNET_PeerIdentity *peer) |
1609 | { | ||
1610 | struct GNUNET_MESH_PeerControl msg; | ||
1611 | |||
1612 | msg.header.size = htons (sizeof (struct GNUNET_MESH_PeerControl)); | ||
1613 | msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_LOCAL_PEER_BLACKLIST); | ||
1614 | msg.tunnel_id = htonl (tunnel->tid); | ||
1615 | msg.peer = *peer; | ||
1616 | send_packet (tunnel->mesh, &msg.header, tunnel); | ||
1617 | |||
1618 | return; | ||
1619 | } | ||
1592 | 1620 | ||
1593 | 1621 | ||
1594 | /** | 1622 | /** |
@@ -1602,7 +1630,18 @@ GNUNET_MESH_peer_blacklist (struct GNUNET_MESH_Tunnel *tunnel, | |||
1602 | */ | 1630 | */ |
1603 | void | 1631 | void |
1604 | GNUNET_MESH_peer_unblacklist (struct GNUNET_MESH_Tunnel *tunnel, | 1632 | GNUNET_MESH_peer_unblacklist (struct GNUNET_MESH_Tunnel *tunnel, |
1605 | const struct GNUNET_PeerIdentity *peer); | 1633 | const struct GNUNET_PeerIdentity *peer) |
1634 | { | ||
1635 | struct GNUNET_MESH_PeerControl msg; | ||
1636 | |||
1637 | msg.header.size = htons (sizeof (struct GNUNET_MESH_PeerControl)); | ||
1638 | msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_LOCAL_PEER_UNBLACKLIST); | ||
1639 | msg.tunnel_id = htonl (tunnel->tid); | ||
1640 | msg.peer = *peer; | ||
1641 | send_packet (tunnel->mesh, &msg.header, tunnel); | ||
1642 | |||
1643 | return; | ||
1644 | } | ||
1606 | 1645 | ||
1607 | 1646 | ||
1608 | /** | 1647 | /** |