Changeset 740 for vendor/current/lib/util/util.h
- Timestamp:
- Nov 14, 2012, 12:59:34 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
vendor/current/lib/util/util.h
r414 r740 22 22 #define _SAMBA_UTIL_H_ 23 23 24 #if _SAMBA_BUILD_ == 4 25 #include "../lib/util/charset/charset.h" 26 #endif 27 #include "../lib/util/attr.h" 24 #include "lib/util/charset/charset.h" 25 #include "lib/util/attr.h" 28 26 29 27 /* for TALLOC_CTX */ … … 40 38 extern const char *panic_action; 41 39 42 #include "../lib/util/time.h" 43 #include "../lib/util/data_blob.h" 44 #include "../lib/util/xfile.h" 45 #include "../lib/util/mutex.h" 46 #include "../lib/util/byteorder.h" 47 #include "../lib/util/talloc_stack.h" 40 #include "lib/util/time.h" 41 #include "lib/util/data_blob.h" 42 #include "lib/util/xfile.h" 43 #include "lib/util/byteorder.h" 44 #include "lib/util/talloc_stack.h" 48 45 49 46 /** … … 61 58 #endif 62 59 63 #if _SAMBA_BUILD_ == 464 #ifdef VALGRIND65 #define strlen(x) valgrind_strlen(x)66 size_t valgrind_strlen(const char *s);67 #endif68 #endif69 70 60 #ifndef ABS 71 61 #define ABS(a) ((a)>0?(a):(-(a))) 72 62 #endif 73 63 74 #include " ../lib/util/memory.h"64 #include "lib/util/memory.h" 75 65 76 66 /** … … 89 79 **/ 90 80 _PUBLIC_ void fault_setup(const char *pname); 81 _PUBLIC_ void fault_setup_disable(void); 91 82 #endif 92 83 … … 143 134 _PUBLIC_ pid_t sys_getpid(void); 144 135 136 _PUBLIC_ int sys_getpeereid( int s, uid_t *uid); 137 138 struct sockaddr; 139 140 _PUBLIC_ int sys_getnameinfo(const struct sockaddr *psa, 141 int salen, 142 char *host, 143 size_t hostlen, 144 char *service, 145 size_t servlen, 146 int flags); 147 _PUBLIC_ int sys_connect(int fd, const struct sockaddr * addr); 148 145 149 /* The following definitions come from lib/util/genrand.c */ 146 147 150 /** 148 151 Copy any user given reseed data. … … 177 180 **/ 178 181 _PUBLIC_ bool check_password_quality(const char *s); 182 183 /** 184 * Generate a random text password. 185 */ 186 _PUBLIC_ char *generate_random_password(TALLOC_CTX *mem_ctx, size_t min, size_t max); 179 187 180 188 /** … … 451 459 /** 452 460 * build a null terminated list of strings from an argv-like input string 453 * Entries are sep erated by spaces and can be enclosed by quotes.461 * Entries are separated by spaces and can be enclosed by quotes. 454 462 * Does NOT support escaping 455 463 */ … … 459 467 * join a list back to one string 460 468 */ 461 _PUBLIC_ char *str_list_join(TALLOC_CTX *mem_ctx, const char **list, char sep erator);469 _PUBLIC_ char *str_list_join(TALLOC_CTX *mem_ctx, const char **list, char separator); 462 470 463 471 /** join a list back to one (shell-like) string; entries 464 * sep erated by spaces, using quotes where necessary */472 * separated by spaces, using quotes where necessary */ 465 473 _PUBLIC_ char *str_list_join_shell(TALLOC_CTX *mem_ctx, const char **list, char sep); 466 474 … … 478 486 Return true if all the elements of the list match exactly. 479 487 */ 480 _PUBLIC_ bool str_list_equal(const char * *list1, const char **list2);488 _PUBLIC_ bool str_list_equal(const char * const *list1, const char * const *list2); 481 489 482 490 /** … … 535 543 _PUBLIC_ const char **str_list_copy_const(TALLOC_CTX *mem_ctx, 536 544 const char **list); 545 546 /** 547 * Needed for making an "unconst" list "const" 548 */ 549 _PUBLIC_ const char **const_str_list(char **list); 537 550 538 551 … … 597 610 _PUBLIC_ bool large_file_support(const char *path); 598 611 612 /* 613 compare two files, return true if the two files have the same content 614 */ 615 bool file_compare(const char *path1, const char *path2); 616 599 617 /* The following definitions come from lib/util/util.c */ 600 618 … … 641 659 Sleep for a specified number of milliseconds. 642 660 **/ 643 _PUBLIC_ void msleep(unsigned int t);661 _PUBLIC_ void smb_msleep(unsigned int t); 644 662 645 663 /** … … 647 665 **/ 648 666 _PUBLIC_ char* get_myname(TALLOC_CTX *mem_ctx); 649 650 /**651 Return true if a string could be a pure IP address.652 **/653 _PUBLIC_ bool is_ipaddress(const char *str);654 655 /**656 Interpret an internet address or name into an IP address in 4 byte form.657 **/658 _PUBLIC_ uint32_t interpret_addr(const char *str);659 660 /**661 A convenient addition to interpret_addr().662 **/663 _PUBLIC_ struct in_addr interpret_addr2(const char *str);664 665 /**666 Check if an IP is the 0.0.0.0.667 **/668 _PUBLIC_ bool is_zero_ip_v4(struct in_addr ip);669 670 /**671 Are two IPs on the same subnet?672 **/673 _PUBLIC_ bool same_net_v4(struct in_addr ip1,struct in_addr ip2,struct in_addr mask);674 675 _PUBLIC_ bool is_ipaddress_v4(const char *str);676 667 677 668 /** … … 687 678 688 679 /** 680 * Write dump of binary data to a callback 681 */ 682 void dump_data_cb(const uint8_t *buf, int len, 683 bool omit_zero_bytes, 684 void (*cb)(const char *buf, void *private_data), 685 void *private_data); 686 687 /** 689 688 * Write dump of binary data to the log file. 690 689 * … … 697 696 * 698 697 * The data is only written if the log level is at least level. 699 * 16 zero bytes in a row are om mited698 * 16 zero bytes in a row are omitted 700 699 */ 701 700 _PUBLIC_ void dump_data_skip_zeros(int level, const uint8_t *buf, int len); … … 784 783 #endif 785 784 786 /* The following definitions come from lib/util/mutex.c */787 788 789 /**790 register a set of mutex/rwlock handlers.791 Should only be called once in the execution of smbd.792 */793 _PUBLIC_ bool register_mutex_handlers(const char *name, struct mutex_ops *ops);794 795 785 /* The following definitions come from lib/util/idtree.c */ 796 786 … … 840 830 Become a daemon, discarding the controlling terminal. 841 831 **/ 842 _PUBLIC_ void become_daemon(bool do_fork, bool no_process_group );832 _PUBLIC_ void become_daemon(bool do_fork, bool no_process_group, bool log_stdout); 843 833 844 834 /** … … 853 843 854 844 void print_asc(int level, const uint8_t *buf,int len); 845 void print_asc_cb(const uint8_t *buf, int len, 846 void (*cb)(const char *buf, void *private_data), 847 void *private_data); 855 848 856 849 /** … … 862 855 863 856 bool add_uid_to_array_unique(TALLOC_CTX *mem_ctx, uid_t uid, 864 uid_t **uids, size_t *num_uids);857 uid_t **uids, uint32_t *num_uids); 865 858 bool add_gid_to_array_unique(TALLOC_CTX *mem_ctx, gid_t gid, 866 gid_t **gids, size_t *num_gids); 867 859 gid_t **gids, uint32_t *num_gids); 860 861 /** 862 * Allocate anonymous shared memory of the given size 863 */ 864 void *anonymous_shared_allocate(size_t bufsz); 865 void anonymous_shared_free(void *ptr); 866 867 /* 868 run a command as a child process, with a timeout. 869 870 any stdout/stderr from the child will appear in the Samba logs with 871 the specified log levels 872 873 If callback is set then the callback is called on completion 874 with the return code from the command 875 */ 876 struct tevent_context; 877 struct tevent_req; 878 struct tevent_req *samba_runcmd_send(TALLOC_CTX *mem_ctx, 879 struct tevent_context *ev, 880 struct timeval endtime, 881 int stdout_log_level, 882 int stderr_log_level, 883 const char * const *argv0, ...); 884 int samba_runcmd_recv(struct tevent_req *req, int *perrno); 885 886 #ifdef DEVELOPER 887 void samba_start_debugger(void); 888 #endif 868 889 869 890 #endif /* _SAMBA_UTIL_H_ */
Note:
See TracChangeset
for help on using the changeset viewer.