2 #include <event2/event.h>
15 TRPC_INSTANCE *trpc_new (TALLOC_CTX *mem_ctx)
17 return talloc_zero(mem_ctx, TRPC_INSTANCE);
20 void trpc_free (TRPC_INSTANCE *trpc)
26 /* Connect to a TRP server */
27 int trpc_open_connection (TRPC_INSTANCE *trpc,
34 unsigned int use_port = 0;
41 tr_debug("trpc_open_connection: opening GSS connection to %s:%d", server, use_port);
42 err = gsscon_connect(server, use_port, "trustrouter", &conn, gssctx);
51 /* simple function, based on tidc_send_req */
52 int trpc_send_msg (TRPC_INSTANCE *trpc,
55 const char *msg_content,
64 /* Send the request over the connection */
65 if (err = gsscon_write_encrypted_token (conn,
68 strlen(msg_content))) {
69 tr_err( "trpc_send_msg: Error sending message over connection.\n");
73 /* Read the response from the connection */
74 if (err = gsscon_read_encrypted_token(conn, gssctx, &resp_buf, &resp_buflen)) {
80 tr_debug( "trpc_send_msg: Response Received (%u bytes).\n", (unsigned) resp_buflen);
81 tr_debug( "%s\n", resp_buf);
84 /* Call the caller's response function */
85 (*resp_handler)(trpc, resp_buf, cookie);