コード例 #1
0
func testNewLinuxHostTaoServer(t *testing.T) (Tao, error) {
	lh, err := testNewRootLinuxHost()
	if err != nil {
		return nil, fmt.Errorf("Can't make root linux host: %s", err)
	}

	hostRead, childWrite, err := os.Pipe()
	if err != nil {
		return nil, fmt.Errorf("Can't make pipe: %s", err)
	}

	childRead, hostWrite, err := os.Pipe()
	if err != nil {
		childWrite.Close()
		hostRead.Close()
		return nil, fmt.Errorf("Can't make pipe: %s", err)
	}

	hostChannel := util.NewPairReadWriteCloser(hostRead, hostWrite)
	childChannel := util.NewPairReadWriteCloser(childRead, childWrite)

	child := &LinuxHostChild{
		channel:      hostChannel,
		ChildSubprin: []auth.PrinExt{auth.PrinExt{Name: "TestChild"}},
		Cmd:          nil, // The Cmd field is not used in this test.
	}

	go NewLinuxHostTaoServer(lh, child).Serve(hostChannel)
	return &RPC{protorpc.NewClient(childChannel), "Tao"}, nil
}
コード例 #2
0
ファイル: rpc.go プロジェクト: William-J-Earl/cloudproxy
// DeserializeUnixSocketRPC produces a RPC from a path string.
func DeserializeUnixSocketRPC(p string) (*RPC, error) {
	if p == "" {
		return nil, newError("taorpc: missing host Tao spec" +
			" (ensure $" + HostSpecEnvVar + " is set)")
	}

	ms, err := util.DeserializeUnixSocketMessageStream(p)
	if err != nil {
		return nil, err
	}

	return &RPC{protorpc.NewClient(ms), "Tao"}, nil
}
コード例 #3
0
ファイル: rpc.go プロジェクト: William-J-Earl/cloudproxy
// DeserializeFileRPC produces a RPC from a string representing a file.
func DeserializeFileRPC(s string) (*RPC, error) {
	if s == "" {
		return nil, newError("taorpc: missing host Tao spec" +
			" (ensure $" + HostSpecEnvVar + " is set)")
	}
	r := strings.TrimPrefix(s, "tao::RPC+")
	if r == s {
		return nil, newError("taorpc: unrecognized $" + HostSpecEnvVar + " string " + s)
	}
	ms, err := util.DeserializeFileMessageStream(r)
	if err != nil {
		return nil, newError("taorpc: unrecognized $" + HostSpecEnvVar + " string " + s +
			" (" + err.Error() + ")")
	}
	return &RPC{protorpc.NewClient(ms), "Tao"}, nil
}