/* * echo_server : demo DCE RPC application * * Jim Doyle, jrd@bu.edu 09-05-1998 * * */ #if HAVE_CONFIG_H #include #endif #ifndef _POSIX_PTHREAD_SEMANTICS #define _POSIX_PTHREAD_SEMANTICS 1 #endif #include #include #include #include #include #include "echon.h" #include "misc.h" #ifndef _WIN32 static void wait_for_signals(void); #endif /* * * A template DCE RPC server * * main() contains the basic calls needed to register an interface, * get communications endpoints, and register the endpoints * with the endpoint mapper. * * ReverseIt() implements the interface specified in echo.idl * */ int main(int ac ATTRIBUTE_UNUSED, char *av[] ATTRIBUTE_UNUSED) { unsigned32 status; rpc_binding_vector_p_t server_binding; char * string_binding; unsigned32 i; /* * Register the Interface with the local endpoint mapper (rpcd) */ printf ("Registering server.... \n"); rpc_server_register_if(echon_v1_0_s_ifspec, NULL, NULL, &status); chk_dce_err(status, "rpc_server_register_if()", "", 1); printf("registered.\nPreparing binding handle...\n"); rpc_server_use_protseq((unsigned_char_p_t)"ncacn_ip_tcp", rpc_c_protseq_max_calls_default, &status); chk_dce_err(status, "rpc_server_use_all_protseqs()", "", 1); rpc_server_inq_bindings(&server_binding, &status); chk_dce_err(status, "rpc_server_inq_bindings()", "", 1); /* * Register bindings with the endpoint mapper */ printf("registering bindings with endpoint mapper\n"); rpc_ep_register(echon_v1_0_s_ifspec, server_binding, NULL, (unsigned char *)"QDA application server", &status); chk_dce_err(status, "rpc_ep_register()", "", 1); printf("registered.\n"); /* * Print out the servers endpoints (TCP and UDP port numbers) */ printf ("Server's communications endpoints are:\n"); for (i=0; i