[svn-commits] file: trunk r65248 - in /trunk/main: adsistub.c cryptostub.c

svn-commits at lists.digium.com svn-commits at lists.digium.com
Sun May 20 10:52:00 MST 2007


Author: file
Date: Sun May 20 12:52:00 2007
New Revision: 65248

URL: http://svn.digium.com/view/asterisk?view=rev&rev=65248
Log:
Clean up adsistub file a bit (just spacing) and change over the crypto sub to use this build_stub macro strategy.

Modified:
    trunk/main/adsistub.c
    trunk/main/cryptostub.c

Modified: trunk/main/adsistub.c
URL: http://svn.digium.com/view/asterisk/trunk/main/adsistub.c?view=diff&rev=65248&r1=65247&r2=65248
==============================================================================
--- trunk/main/adsistub.c (original)
+++ trunk/main/adsistub.c Sun May 20 12:52:00 2007
@@ -51,33 +51,33 @@
 int (*func_name)(__VA_ARGS__) = \
 	stub_##func_name;
 
-build_stub(ast_adsi_channel_init,struct ast_channel *chan)
-build_stub(ast_adsi_begin_download,struct ast_channel *chan, char *service, unsigned char *fdn, unsigned char *sec, int version)
-build_stub(ast_adsi_end_download,struct ast_channel *chan)
-build_stub(ast_adsi_channel_restore,struct ast_channel *chan)
-build_stub(ast_adsi_print,struct ast_channel *chan, char **lines, int *align, int voice)
-build_stub(ast_adsi_load_session,struct ast_channel *chan, unsigned char *app, int ver, int data)
-build_stub(ast_adsi_unload_session,struct ast_channel *chan)
-build_stub(ast_adsi_transmit_messages,struct ast_channel *chan, unsigned char **msg, int *msglen, int *msgtype)
-build_stub(ast_adsi_transmit_message,struct ast_channel *chan, unsigned char *msg, int msglen, int msgtype)
-build_stub(ast_adsi_transmit_message_full,struct ast_channel *chan, unsigned char *msg, int msglen, int msgtype, int dowait)
-build_stub(ast_adsi_read_encoded_dtmf,struct ast_channel *chan, unsigned char *buf, int maxlen)
-build_stub(ast_adsi_connect_session,unsigned char *buf, unsigned char *fdn, int ver)
-build_stub(ast_adsi_query_cpeid,unsigned char *buf)
-build_stub(ast_adsi_query_cpeinfo,unsigned char *buf)
-build_stub(ast_adsi_get_cpeid,struct ast_channel *chan, unsigned char *cpeid, int voice)
-build_stub(ast_adsi_get_cpeinfo,struct ast_channel *chan, int *width, int *height, int *buttons, int voice)
-build_stub(ast_adsi_download_connect,unsigned char *buf, char *service, unsigned char *fdn, unsigned char *sec, int ver)
-build_stub(ast_adsi_disconnect_session,unsigned char *buf)
-build_stub(ast_adsi_download_disconnect,unsigned char *buf)
-build_stub(ast_adsi_data_mode,unsigned char *buf)
-build_stub(ast_adsi_clear_soft_keys,unsigned char *buf)
-build_stub(ast_adsi_clear_screen,unsigned char *buf)
-build_stub(ast_adsi_voice_mode,unsigned char *buf, int when)
-build_stub(ast_adsi_available,struct ast_channel *chan)
-build_stub(ast_adsi_display,unsigned char *buf, int page, int line, int just, int wrap, char *col1, char *col2)
-build_stub(ast_adsi_set_line,unsigned char *buf, int page, int line)
-build_stub(ast_adsi_load_soft_key,unsigned char *buf, int key, const char *llabel, const char *slabel, char *ret, int data)
-build_stub(ast_adsi_set_keys,unsigned char *buf, unsigned char *keys)
-build_stub(ast_adsi_input_control,unsigned char *buf, int page, int line, int display, int format, int just)
-build_stub(ast_adsi_input_format,unsigned char *buf, int num, int dir, int wrap, char *format1, char *format2)
+build_stub(ast_adsi_channel_init, struct ast_channel *chan)
+build_stub(ast_adsi_begin_download, struct ast_channel *chan, char *service, unsigned char *fdn, unsigned char *sec, int version)
+build_stub(ast_adsi_end_download, struct ast_channel *chan)
+build_stub(ast_adsi_channel_restore, struct ast_channel *chan)
+build_stub(ast_adsi_print, struct ast_channel *chan, char **lines, int *align, int voice)
+build_stub(ast_adsi_load_session, struct ast_channel *chan, unsigned char *app, int ver, int data)
+build_stub(ast_adsi_unload_session, struct ast_channel *chan)
+build_stub(ast_adsi_transmit_messages, struct ast_channel *chan, unsigned char **msg, int *msglen, int *msgtype)
+build_stub(ast_adsi_transmit_message, struct ast_channel *chan, unsigned char *msg, int msglen, int msgtype)
+build_stub(ast_adsi_transmit_message_full, struct ast_channel *chan, unsigned char *msg, int msglen, int msgtype, int dowait)
+build_stub(ast_adsi_read_encoded_dtmf, struct ast_channel *chan, unsigned char *buf, int maxlen)
+build_stub(ast_adsi_connect_session, unsigned char *buf, unsigned char *fdn, int ver)
+build_stub(ast_adsi_query_cpeid, unsigned char *buf)
+build_stub(ast_adsi_query_cpeinfo, unsigned char *buf)
+build_stub(ast_adsi_get_cpeid, struct ast_channel *chan, unsigned char *cpeid, int voice)
+build_stub(ast_adsi_get_cpeinfo, struct ast_channel *chan, int *width, int *height, int *buttons, int voice)
+build_stub(ast_adsi_download_connect, unsigned char *buf, char *service, unsigned char *fdn, unsigned char *sec, int ver)
+build_stub(ast_adsi_disconnect_session, unsigned char *buf)
+build_stub(ast_adsi_download_disconnect, unsigned char *buf)
+build_stub(ast_adsi_data_mode, unsigned char *buf)
+build_stub(ast_adsi_clear_soft_keys, unsigned char *buf)
+build_stub(ast_adsi_clear_screen, unsigned char *buf)
+build_stub(ast_adsi_voice_mode, unsigned char *buf, int when)
+build_stub(ast_adsi_available, struct ast_channel *chan)
+build_stub(ast_adsi_display, unsigned char *buf, int page, int line, int just, int wrap, char *col1, char *col2)
+build_stub(ast_adsi_set_line, unsigned char *buf, int page, int line)
+build_stub(ast_adsi_load_soft_key, unsigned char *buf, int key, const char *llabel, const char *slabel, char *ret, int data)
+build_stub(ast_adsi_set_keys, unsigned char *buf, unsigned char *keys)
+build_stub(ast_adsi_input_control, unsigned char *buf, int page, int line, int display, int format, int just)
+build_stub(ast_adsi_input_format, unsigned char *buf, int num, int dir, int wrap, char *format1, char *format2)

Modified: trunk/main/cryptostub.c
URL: http://svn.digium.com/view/asterisk/trunk/main/cryptostub.c?view=diff&rev=65248&r1=65247&r2=65248
==============================================================================
--- trunk/main/cryptostub.c (original)
+++ trunk/main/cryptostub.c Sun May 20 12:52:00 2007
@@ -33,63 +33,39 @@
 #include "asterisk/crypto.h"
 #include "asterisk/logger.h"
 
-/* Hrm, I wonder if the compiler is smart enough to only create two functions
-   for all these...  I could force it to only make two, but those would be some
-   really nasty looking casts. */
-   
 static struct ast_key *stub_ast_key_get(const char *kname, int ktype)
 {
 	ast_log(LOG_NOTICE, "Crypto support not loaded!\n");
 	return NULL;
 }
 
-static int stub_ast_check_signature(struct ast_key *key, const char *msg, const char *sig)
-{
-	ast_log(LOG_NOTICE, "Crypto support not loaded!\n");
-	return -1;
-}
+#ifdef SKREP
+#define build_stub(func_name,...) \
+static int stub_ ## func_name(__VA_ARGS__) \
+{ \
+        ast_log(LOG_NOTICE, "Crypto support not loaded!\n"); \
+        return -1; \
+} \
+\
+int (*func_name)(__VA_ARGS__) = \
+        stub_ ## func_name;
+#endif
+#define build_stub(func_name,...) \
+static int stub_##func_name(__VA_ARGS__) \
+{ \
+        ast_log(LOG_NOTICE, "Crypto support not loaded!\n"); \
+        return -1; \
+} \
+\
+int (*func_name)(__VA_ARGS__) = \
+        stub_##func_name;
 
-static int stub_ast_check_signature_bin(struct ast_key *key, const char *msg, int msglen, const unsigned char *sig)
-{
-	ast_log(LOG_NOTICE, "Crypto support not loaded!\n");
-	return -1;
-}
+struct ast_key *(*ast_key_get)(const char *key, int type) =
+stub_ast_key_get;
 
-static int stub_ast_sign(struct ast_key *key, char *msg, char *sig) 
-{
-	ast_log(LOG_NOTICE, "Crypto support not loaded!\n");
-	return -1;
-}
-
-static int stub_ast_sign_bin(struct ast_key *key, const char *msg, int msglen, unsigned char *sig)
-{
-	ast_log(LOG_NOTICE, "Crypto support not loaded!\n");
-	return -1;
-}
-
-static int stub_ast_encdec_bin(unsigned char *dst, const unsigned char *src, int srclen, struct ast_key *key)
-{
-	ast_log(LOG_NOTICE, "Crypto support not loaded!\n");
-	return -1;
-}
-
-struct ast_key *(*ast_key_get)(const char *key, int type) = 
-	stub_ast_key_get;
-
-int (*ast_check_signature)(struct ast_key *key, const char *msg, const char *sig) =
-	stub_ast_check_signature;
-	
-int (*ast_check_signature_bin)(struct ast_key *key, const char *msg, int msglen, const unsigned char *sig) =
-	stub_ast_check_signature_bin;
-	
-int (*ast_sign)(struct ast_key *key, char *msg, char *sig) = 
-	stub_ast_sign;
-
-int (*ast_sign_bin)(struct ast_key *key, const char *msg, int msglen, unsigned char *sig) =
-	stub_ast_sign_bin;
-	
-int (*ast_encrypt_bin)(unsigned char *dst, const unsigned char *src, int srclen, struct ast_key *key) =
-	stub_ast_encdec_bin;
-
-int (*ast_decrypt_bin)(unsigned char *dst, const unsigned char *src, int srclen, struct ast_key *key) =
-	stub_ast_encdec_bin;
+build_stub(ast_check_signature, struct ast_key *key, const char *msg, const char *sig);
+build_stub(ast_check_signature_bin, struct ast_key *key, const char *msg, int msglen, const unsigned char *sig);
+build_stub(ast_sign, struct ast_key *key, char *msg, char *sig);
+build_stub(ast_sign_bin, struct ast_key *key, const char *msg, int msglen, unsigned char *sig);
+build_stub(ast_encrypt_bin, unsigned char *dst, const unsigned char *src, int srclen, struct ast_key *key);
+build_stub(ast_decrypt_bin, unsigned char *dst, const unsigned char *src, int srclen, struct ast_key *key);



More information about the svn-commits mailing list