package edu.mit.drkp;


import com.limegroup.gnutella.GUID;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

public class GnutellaRPCInterface
{
    GnutellaHooks hooks = GnutellaHooks.getHooks();
    
    public GnutellaRPCInterface()
    {
        
    }

    public List<String> getAndClearQueries()
    {
        return hooks.getAndClearQueries();
    }

    public List<Map<String, Object>> getAndClearQueryResults()
    {
        return hooks.getAndClearQueryResults();
    }

    public int query(String q)
    {
        try {
            hooks.performQuery(q).bytes();
            return 0;
        } catch (Exception e) {
            e.printStackTrace();
            byte[] x = new byte[1];
            x[0] = 0;
            //return x;
            return 0;
        }
    }

    public int browse(Map<String, Object> rfd)
    {
        try {
            GUID x = hooks.browseHost(rfd);
            if (x == null) {
                //return null;
                return 0;
            } else {
                //return x.bytes();
                return 0;
            }
        } catch (Exception e) {
            e.printStackTrace();
            byte[] x = new byte[1];
            x[0] = 0;
            //return x;
            return 0;
        }

    }
}
